dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.81k stars 3.2k forks source link

Cosmos: Support UDFs #15338

Open TomasHubelbauer opened 5 years ago

TomasHubelbauer commented 5 years ago

I am wondering whether there is an attribute or a fluent API method that would allow me to tell EF Core to map an entity property to a result of a UDF invoked with that document as a parameter so that a context of the collection could be used to compute the value of the property from other documents in the collection.

Specifically, something like this:

SELECT {{ firstName: item.FirstName, lastName: item.LastName, test: udf.test(item) }} FROM AppDbContext item

As opposed to something like this which I assume the Cosmos provider already generates:

SELECT {{ firstName: item.FirstName, lastName: item.LastName, test: item.Test }} FROM AppDbContext item

Further technical details

EF Core version: Microsoft.EntityFrameworkCore.Cosmos 2.2.4 Database Provider: Microsoft.EntityFrameworkCore.Cosmos Operating system: Windows 10 IDE: VS Code

ajcvickers commented 5 years ago

This is in the master list for Cosmos in issue #12086. Keeping this open to track the specific work, now referenced from the master list.

smitpatel commented 5 years ago

I am adding infrastructure support for this in query pipeline.