组加入 EF Core 3.1
Group join in EF Core 3.1
我正在尝试组加入 EF core 3.1 问题呢returns
Processing of the LINQ expression 'DbSet failed. This may indicate either a bug or a limitation in EF Core
我的代码是这样的
var employees = await (from enrollment in RepositoryContext.Enrollments
join allowance in RepositoryContext.Allowances.Include(y=>y.AllowanceType) on enrollment.EmployeeId equals allowance.EmployeeId
into allowances
select new
{
enrollment,
allowances
}
).AsNoTracking().ToListAsync();
allowances 是物品清单,
运行 像这样的查询是否有任何解决方法,因为我需要它以获得更好的性能。
在这里Query with GroupBy or GroupJoin throws exception is the now closed GitHub issue/discussion where I was trying to convince EF Core team to add GroupJoin
translation. They refused to do that and opened the useless Query: Support GroupJoin when it is final query operator #19930我继续为这样的翻译而战。所以请去那里 comment/vote 提交完整的翻译请求。
您还会在那里找到解决方法 - 而不是不受支持的 GroupJoin
使用等效的受支持的相关子查询方法,例如替换
join allowance in RepositoryContext.Allowances.Include(y => y.AllowanceType)
on enrollment.EmployeeId equals allowance.EmployeeId
into allowances
和
let allowances = RepositoryContext.Allowances.Include(y => y.AllowanceType)
.Where(allowance => enrollment.EmployeeId == allowance.EmployeeId)
我正在尝试组加入 EF core 3.1 问题呢returns
Processing of the LINQ expression 'DbSet failed. This may indicate either a bug or a limitation in EF Core
我的代码是这样的
var employees = await (from enrollment in RepositoryContext.Enrollments
join allowance in RepositoryContext.Allowances.Include(y=>y.AllowanceType) on enrollment.EmployeeId equals allowance.EmployeeId
into allowances
select new
{
enrollment,
allowances
}
).AsNoTracking().ToListAsync();
allowances 是物品清单, 运行 像这样的查询是否有任何解决方法,因为我需要它以获得更好的性能。
在这里Query with GroupBy or GroupJoin throws exception is the now closed GitHub issue/discussion where I was trying to convince EF Core team to add GroupJoin
translation. They refused to do that and opened the useless Query: Support GroupJoin when it is final query operator #19930我继续为这样的翻译而战。所以请去那里 comment/vote 提交完整的翻译请求。
您还会在那里找到解决方法 - 而不是不受支持的 GroupJoin
使用等效的受支持的相关子查询方法,例如替换
join allowance in RepositoryContext.Allowances.Include(y => y.AllowanceType)
on enrollment.EmployeeId equals allowance.EmployeeId
into allowances
和
let allowances = RepositoryContext.Allowances.Include(y => y.AllowanceType)
.Where(allowance => enrollment.EmployeeId == allowance.EmployeeId)