koenbeuk / EntityFrameworkCore.Projectables

Project over properties and functions in your linq queries
MIT License
260 stars 17 forks source link

Add OnlyOnInclude option for the root rewritter #91

Open zoriya opened 8 months ago

zoriya commented 8 months ago

This allows projectable properties to be marked as OnlyOnInclude and only opt-in root query rewriting by explicitly calling a .Include(x => x.ProjectedProperty). This was discussed in #84 by @yinzara.

PS: maybe this should be the default mode for root query rewriting?

(PR based on #90)

koenbeuk commented 8 months ago

I like this, though I'm somewhat in doubt if this is really desired. By default in EF you'll get all properties when you select an Entity. If you want to select a subset then you'll have to be explicit about this. This turns that logic around, (you won't get it unless you explicitly ask for it). Granted this is already the case when it comes to including relationships...