© 2026 Hedgehog Software, LLC

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

Proper way to access Navigational Properties

Hi, I trying to fetch data including the related data on other table. Is this the best way to to do it?

var regularClients = _context.Clients
                .Include(mop => mop.ModeOfPayments)
                .Include(abu => abu.AddedByUser)
                .Include(rq => rq.Request)
                .ThenInclude(user => user.Requestor)
                .Include(rq => rq.Request)
                .ThenInclude(ap => ap.Approvals)
                .ThenInclude(cap => cap.Approver)
                .Include(st => st.StoreType)
                .Include(fd => fd.FixedDiscounts)
                .Include(to => to.Term)
                .ThenInclude(tt => tt.Terms)
                .Include(to => to.Term)
                .ThenInclude(td => td.TermDays)
                .Include(ba => ba.BusinessAddress)
                .Include(oa => oa.OwnersAddress)
                .Include(bc => bc.BookingCoverages)
                .Include(fr => fr.FreebiesRequests)
                .ThenInclude(fi => fi.FreebieItems)
                .ThenInclude(item => item.Items)
                .ThenInclude(uom => uom.Uom)
                .Include(lf => lf.ListingFees)
                .ThenInclude(li => li.ListingFeeItems)
                .ThenInclude(item => item.Item)
                .ThenInclude(uom => uom.Uom)
                .Include(cd => cd.ClientDocuments)
                .AsNoTracking();
var regularClients = _context.Clients
                .Include(mop => mop.ModeOfPayments)
                .Include(abu => abu.AddedByUser)
                .Include(rq => rq.Request)
                .ThenInclude(user => user.Requestor)
                .Include(rq => rq.Request)
                .ThenInclude(ap => ap.Approvals)
                .ThenInclude(cap => cap.Approver)
                .Include(st => st.StoreType)
                .Include(fd => fd.FixedDiscounts)
                .Include(to => to.Term)
                .ThenInclude(tt => tt.Terms)
                .Include(to => to.Term)
                .ThenInclude(td => td.TermDays)
                .Include(ba => ba.BusinessAddress)
                .Include(oa => oa.OwnersAddress)
                .Include(bc => bc.BookingCoverages)
                .Include(fr => fr.FreebiesRequests)
                .ThenInclude(fi => fi.FreebieItems)
                .ThenInclude(item => item.Items)
                .ThenInclude(uom => uom.Uom)
                .Include(lf => lf.ListingFees)
                .ThenInclude(li => li.ListingFeeItems)
                .ThenInclude(item => item.Item)
                .ThenInclude(uom => uom.Uom)
                .Include(cd => cd.ClientDocuments)
                .AsNoTracking();
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 Core navigational properties
C#CC# / help
3y ago
Dynamic properties of html tag in Blazor - Proper way.
C#CC# / help
2y ago
Proper way to deploy application?
C#CC# / help
14mo ago
JSON deserialization (proper way?)
C#CC# / help
3y ago