You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to query against owned objects to see if they are null but I get an exception and can't find a work-around to achieving the query (see sample code).
I know I can add .AsEnumerable() but this will make it a client-side query which I don' t want as it will surely bring all records from the database into process to run the query/filter.
If this is clearly documented somewhere I'm sorry for missing it.
If it makes a difference to the answer my production container is used for multiple types and so I use .HasDiscriminator().
System.InvalidOperationException: 'The LINQ expression 'DbSet<Order>()
.Where(o => EF.Property<StreetAddress>(o, "ShippingAddress") != null)' could not be translated. Additional information: Translation of member 'OrderId' on entity type 'Order.ShippingAddress#StreetAddress' failed. This commonly occurs when the specified member is unmapped.
Translation of member 'OrderPartitionKey' on entity type 'Order.ShippingAddress#StreetAddress' failed. This commonly occurs when the specified member is unmapped. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.'
Provider and version information
EF Core version: 5.0.2
Database provider: Microsoft.EntityFrameworkCore.Cosmos (version 5.0.2)
Target framework: This example is .NET 5.0 but the issue also happens in my project in .netcore 3.2
Operating system: Windows 10
IDE: (e.g. Visual Studio 2019 16.8.4)
The text was updated successfully, but these errors were encountered:
The issue happens since we try to rewrite to entity equality but the property doesn't exist on server side for owned entity. We need to translate it to IS_DEFINED which requires refactoring in cosmos SQL tree.
I see you guys are punting on this. This is kind of an importing thing, we can't safely query any owned entities without it. Do you have a work around? we are dealing with the IQueryable
Question
I am trying to query against owned objects to see if they are null but I get an exception and can't find a work-around to achieving the query (see sample code).
I know I can add
.AsEnumerable()
but this will make it a client-side query which I don' t want as it will surely bring all records from the database into process to run the query/filter.If this is clearly documented somewhere I'm sorry for missing it.
If it makes a difference to the answer my production container is used for multiple types and so I use .HasDiscriminator().
Include your code
To demonstrate the issue, I am using the sample found here https://github.com/dotnet/EntityFramework.Docs/tree/master/samples/core/Cosmos and have added the below simple query into sample.cs.
Error
Provider and version information
EF Core version: 5.0.2
Database provider: Microsoft.EntityFrameworkCore.Cosmos (version 5.0.2)
Target framework: This example is .NET 5.0 but the issue also happens in my project in .netcore 3.2
Operating system: Windows 10
IDE: (e.g. Visual Studio 2019 16.8.4)
The text was updated successfully, but these errors were encountered: