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 try to get the VAT rows that has a specific DEVICECODE value with this LINQ expression but it is not working
using ctx = new BusinessRulesContext();varvat= ctx.Vats
.Where(p => p.DeviceCodes.Any(c => c.Code =="04")).ToList();
and i get the following exception
The LINQ expression 'DbSet<Vat>()
.Where(v => EF.Property<List<DeviceCode>>(v, "DeviceCodes")
.AsQueryable()
.Any(o => o.Code == "04"))' 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 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
I have a table "VAT" with a json field defined as List.
My achievement is to get the specific VAT which has a specific DeviceCode.
The table is defined as below
with this specific dbContext
the deviceCode object is defined as
I try to get the VAT rows that has a specific DEVICECODE value with this LINQ expression but it is not working
and i get the following exception
where am I wrong?
Packages versions:
Microsoft.EntityFrameworkCore: 7.0.5
Microsoft.EntityFrameworkCore.Relational: 7.0.5
Microsoft.EntityFrameworkCore.SqlServer: 7.0.5
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 7.0
Operating system: WIN 11 22H2
IDE: Visual Studio 2022 17.5
The text was updated successfully, but these errors were encountered: