© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
3 replies
127001

❔ EF | Get N level associated data

var data = dbContext.Orders
                .Include(x => x.OrderLines)
                    .ThenInclude(x => x.Product)
                    .ThenInclude(x => x.Category)
                .Include(x => x.Customer)
                .Include(x => x.Address)
                .ToList();
var data = dbContext.Orders
                .Include(x => x.OrderLines)
                    .ThenInclude(x => x.Product)
                    .ThenInclude(x => x.Category)
                .Include(x => x.Customer)
                .Include(x => x.Address)
                .ToList();

Data association is:
Order -> OrderLine -> Product -> Category & ProductAdditionalInfos
Order -> OrderLine -> Product -> Category & ProductAdditionalInfos

Products table has association to (1-N) ProductAdditionalInfos table which contains some information like Color, Size etc.
How can I also add in this query ?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

EF 6 - Creating entity with n-n
C#CC# / help
4y ago
Ef core seed (data)
C#CC# / help
12mo ago
Data retrieval EF-core
C#CC# / help
15mo ago
EF-Core data reference [Answered]
C#CC# / help
4y ago