-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop using materializer expression in query #32923
Comments
@AndriySvyryd just to note that the variability of materializers goes beyond just the different combinations of Includes - there's tracking/no-tracking, split vs. single query, etc. etc. All these combinations produce fundamentally different materializers, and creating a "generic" materializer that can handle all/most cases seems like it would start moving in a direction which puts into question code generation in the first place... Of course, we could also pre-generate materializers for the various permutations (a bit like we want to pre-generate SQLs for various parameter nullness combinations), but I'm not sure we want to go in this direction either... |
After an offline conversation, I understand that the above refers to the more narrow materializer (i.e. instantiate an entity CLR type based on values from DbDataReader) rather than to the whole shaper (which contains/drives the materializers), so then stuff like tracking/no-tracking or split/single indeed aren't relevant there. |
I've also opened #34445, which is about reusing shapers (not materializers) across queries - both that and this can be implemented. @AndriySvyryd am wondering what's the advantage of doing materializer generation in the compiled model, as opposed to generating it in the query pipeline as today, but implementing caching for reuse... I can see the following advantages in keeping this in query:
|
It doesn't have to be in the compiled model, it could be generated by the precompiled queries. The important part is that it shouldn't be inlined if it's used in more than one query. |
Agreed. |
Instead use the metarializer Func that can be part of the compiled model.
This would require refactoring to make the materializer compatible with any combination of Includes
The text was updated successfully, but these errors were encountered: