1

I migrating from EF core 2.2 to 3.1 and a query that used to work, now throws an exception . I know that there are breaking changes to this version but I need to find a proper workaround for my query, hope someone could help :)

The query:

return await dbContext.JobsBulkDbSet.Where(i => i.Uuid == uuid)
                    .GroupJoin(dbContext.JobDbSet.Include(x => x.UpgradeJobs),
                        bulk => bulk.Uuid,
                        job => job.JobsBulkEntityUuid,
                        (bulk, jobs) => SetJobs(bulk, jobs)).AsNoTracking().FirstOrDefaultAsync();

And the error I get is :

Processing of the LINQ expression 'DbSet<JobsBulkEntity>
    .Where(i => i.Uuid == __uuid_0)
    .GroupJoin(
        outer: DbSet<JobEntity>
            .Include(x => x.UpgradeJobs), 
        inner: bulk => bulk.Uuid, 
        outerKeySelector: job => job.JobsBulkEntityUuid, 
        innerKeySelector: (bulk, jobs) => EFJobsBulkRepository.SetJobs(
            bulk: bulk, 
            jobs: jobs))' 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.

Thanks

  • Does this answer your question? [Can't make GroupJoin work. NavigationExpandingExpressionVisitor exception](https://stackoverflow.com/questions/64388869/cant-make-groupjoin-work-navigationexpandingexpressionvisitor-exception) – Ivan Stoev Jan 05 '22 at 13:47
  • See also https://stackoverflow.com/questions/66844615/query-with-groupjoin-cannot-be-translated-although-its-documened-as-being-sup/66845729#66845729 and https://stackoverflow.com/questions/68712750/the-linq-expression-expression-could-not-be-translated-either-rewrite-the-que/68713238#68713238 – Ivan Stoev Jan 05 '22 at 13:48
  • 1
    Please also note that `Include` will be ignored, since it isn't applied on the root query entity, and also custom methods like `SetJobs` (whatever it is) are not supported either. Best is to simply define and use navigation properties. – Ivan Stoev Jan 05 '22 at 13:54
  • Thasks @IvanStoev, do you know how to fix it ? – user1977367 Jan 05 '22 at 14:21

0 Answers0