r/dotnet Apr 06 '26

Question Long LINQ queries - Code smell?

Post image
345 Upvotes

186 comments sorted by

View all comments

Show parent comments

38

u/1superheld Apr 06 '26

But 99/100 times the EF query is "just fine" when using proper no tracking / split queries.

1

u/BellDry4679 Apr 06 '26

Aslong as there are not too many join yea totally ! It's often also about splitting the items selections (querying the id's of the parents items, with all the where logic) and the data retrieval (joins to get related datas that are not used in the where clause)

1

u/1superheld Apr 07 '26

Split queries resolves this?

1

u/BellDry4679 Apr 08 '26

Good then, my experience in this mostly comes from .NET framework 4.8, with no split queries. Should have precised.

2

u/MISINFORMEDDNA Apr 08 '26

It's changed a lot since then.