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 have a Blazor WASM hosted app that uses OData to read data from the server. I am getting an error an error when trying to filter on a 2nd level property.
I have seen this issue raised a couple of times and both of them are closed and the fixes incorporated in the latest release.
In my full project (not the repo below), I have other 2nd level entities that use a Guid as an Id. When they are filtered using the same method mentioned below, it works. So it appears that it is having an issue filtering int 2nd level properties.
Set the Server project as the startup project and run
Using Postman or a new browser tab, run the following odata query
https://localhost:5001/odata/Courses?$count=true&$expand=Instructor&$filter=Instructor/Id in (1)
Observe the stacktrace in the response body
For added insight, a very similar query works great
Use the following similar query
https://localhost:5001/odata/Courses?$count=true&$expand=Instructor&$filter=Instructor/Name in ('Mr. Smith')
Stack trace
System.InvalidOperationException: The LINQ expression 'DbSet<Course>
.LeftJoin(
outer: DbSet<Instructor>,
inner: c => EF.Property<Nullable<int>>(c, "InstructorId"),
outerKeySelector: i => EF.Property<Nullable<int>>(i, "Id"),
innerKeySelector: (o, i) => new TransparentIdentifier<Course, Instructor>(
Outer = o,
Inner = i
))
.LongCount(c => (IEnumerable<Nullable<int>>)<CastIterator>d__63<Nullable<int>> { 1, }
.Contains((Nullable<int>)c.Inner.Id))' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync().
Provider Information
EF Core version: 3.1.9
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .Net Core 3.1
Operating system: Windows 10 Enterprise 1903
IDE: Visual Studio Professional 2019 16.7.3
The text was updated successfully, but these errors were encountered:
Information
I have a Blazor WASM hosted app that uses OData to read data from the server. I am getting an error an error when trying to filter on a 2nd level property.
I have seen this issue raised a couple of times and both of them are closed and the fixes incorporated in the latest release.
Edit
In my full project (not the repo below), I have other 2nd level entities that use a
Guid
as an Id. When they are filtered using the same method mentioned below, it works. So it appears that it is having an issue filteringint
2nd level properties.Steps to reproduce
link to repo
https://localhost:5001/odata/Courses?$count=true&$expand=Instructor&$filter=Instructor/Id in (1)
For added insight, a very similar query works great
https://localhost:5001/odata/Courses?$count=true&$expand=Instructor&$filter=Instructor/Name in ('Mr. Smith')
Stack trace
Provider Information
EF Core version: 3.1.9
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .Net Core 3.1
Operating system: Windows 10 Enterprise 1903
IDE: Visual Studio Professional 2019 16.7.3
The text was updated successfully, but these errors were encountered: