EF Core 2.2 LINQ查询在EF Core 3.0中不起作用

问题描述 投票:0回答:1

下面的代码在EF Core 2.2上正常工作,但在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();

我得到的错误:

LINQ表达式'AsQueryable(Select(来源:NavigationTreeExpression值:默认(IGrouping)表达式:(未处理的参数:e),选择器:(p)=> p.CategoryName))'通过'NavigationExpandingExpressionVisitor'失败。这可能表示EF Core中存在错误或限制。有关更多详细信息,请参见https://go.microsoft.com/fwlink/?linkid=2101433

需要帮助

entity-framework ef-core-3.0
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.