efcore icon indicating copy to clipboard operation
efcore copied to clipboard

Multi level ThenInclude issue

Open ccaymaz opened this issue 7 years ago • 2 comments

Hi, I am having an issue with using Include > ThenInclude.

I have 5 tables and all of them have one-to-many relationships. When I try to call all collections with ThenInclude, my application locks.

            var estimate = await this._estimateRepository.List
                .Include(s => s.Categories)
                    .ThenInclude(s => s.Items)
                        .ThenInclude(s => s.Tasks)
                            .ThenInclude(s => s.TaskDetails)
                .SingleAsync(s => s.Id == id);

There is no exception. I enabled logging for queries. EFCore can generate all queries until Task level. TaskDetail level is not working.

Is there any limitations for ThenInclude?

Thank you

Further technical details

EF Core version: 2.2.6 Database provider: Microsoft.EntityFrameworkCore.SqlServer Target framework: .NET Core 2.2 Operating system: Win IDE: Visual Studio 2019 16.2.5

ccaymaz avatar Sep 23 '19 06:09 ccaymaz

@ccaymaz - Can you try with 3.0 version? The implementation of collection include has significantly so this may not cause issue anymore.

smitpatel avatar Sep 23 '19 17:09 smitpatel

Thanks four your reply @smitpatel. I have tested 3.0 and it works like a charm.

ccaymaz avatar Sep 24 '19 16:09 ccaymaz