Group join in EF Core 3.1

后端 未结 1 1732
星月不相逢
星月不相逢 2021-01-13 07:57

I am trying to group join in EF core 3.1 the problem it returns

Processing of the LINQ expression \'DbSet failed. This may indicate either a bug or a

相关标签:
1条回答
  • 2021-01-13 08:28

    Here 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 where I continue the fight for such translation. So please go there and comment/vote up for the full translation request.

    You will also find there the workaround - instead of unsupported GroupJoin use the equivalent supported correlated subquery approach, e.g. replace

    join allowance in RepositoryContext.Allowances.Include(y => y.AllowanceType)
        on enrollment.EmployeeId equals allowance.EmployeeId
    into allowances
    

    with

    let allowances = RepositoryContext.Allowances.Include(y => y.AllowanceType)
        .Where(allowance => enrollment.EmployeeId == allowance.EmployeeId)
    
    0 讨论(0)
提交回复
热议问题