Below code works fine at EF Core 2.2 bu not working on EF core 3.0
var items = (from asset in Context.Assets join assetCategory in Context.AssetCategories on asset.CategoryId equals assetCategory.Id group assetCategory by assetCategory.Id into assetCategories select new AssetCategorySummary { CategoryId = assetCategories.Key, CategoryName = assetCategories.Select(p => p.CategoryName).FirstOrDefault(), TotalAsset = assetCategories.Count() }).ToListAsync();
the error I am getting:
Processing of the LINQ expression 'AsQueryable(Select<AssetCategory, string>( source: NavigationTreeExpression Value: default(IGrouping<Guid, AssetCategory>) Expression: (Unhandled parameter: e), selector: (p) => p.CategoryName))' by 'NavigationExpandingExpressionVisitor' failed. This may indicate either a bug or a limitation in EF Core. See https://go.microsoft.com/fwlink/?linkid=2101433 for more detailed information.
need help please
Entity Framework Core uses Language-Integrated Query (LINQ) to query data from the database. LINQ allows you to use C# (or your . NET language of choice) to write strongly typed queries.
LINQ queries are always executed when the query variable is iterated over, not when the query variable is created. This is called deferred execution. You can also force a query to execute immediately, which is useful for caching query results. This is described later in this topic.
No. Linq as in query over the data-in-memory that was loaded using your stored procedures (which means that your queries won't be translated to SQL)?
This is due to one of the breaking changes in EF Core 3.0 and that is: LINQ queries are no longer evaluated on the client
So write the query in such way that EF Core can convert the expression into T-SQL or fetch the data into memory and then make your query.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With