You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Move method info lookups to shared internal classes #20631
Note to implementer:the main goal here is removal of duplicates. It may be better to leave single-access MethodInfos co-located with their use. It may also make sense to have multiple shared internal classes.
Hi @ajcvickers / @smitpatel
I would like to pick this one up if no one else is working on this one.
I am thinking of creating separate shared classes, similar to EnumerableMethods for methods that are used in more than one places, like DateTime, DateOnly, string, etc. since they are being used in multiple places (in different providers SQLServer, SQLite, Cosmos db, etc).
@nikhil197 I believe this is no longer a direction we should go in.
We currently indeed use reflection to look up MethodInfos; some of these patterns are understood by the .NET linker, which then refrains from trimming those methods. In effect, this means that EF's pipeline causes a lot more methods to get preserved, even if they never actually get used by user code, only because they could in theory be used and would need to be translated. This results in binaries that are bigger than they need to be.
The alternative is to use string-based matching, where we look at the name of the method in the query pipline, and also at its DeclaringType. That refrains from directly referencing the method in a way that's visible to the linker.
This work is tracked by #26288; I'll go ahead and close this issue.
Activity
ajcvickers commentedon Apr 17, 2020
Note to implementer:the main goal here is removal of duplicates. It may be better to leave single-access MethodInfos co-located with their use. It may also make sense to have multiple shared internal classes.
[-]Put method info lookups to shared internal class[/-][+]Put method info lookups to shared internal classes[/+][-]Put method info lookups to shared internal classes[/-][+]Move method info lookups to shared internal classes[/+]nikhil197 commentedon Aug 18, 2024
Hi @ajcvickers / @smitpatel
I would like to pick this one up if no one else is working on this one.
I am thinking of creating separate shared classes, similar to
EnumerableMethodsfor methods that are used in more than one places, likeDateTime,DateOnly,string, etc. since they are being used in multiple places (in different providers SQLServer, SQLite, Cosmos db, etc).Moved DateTime, DateTimeOffset & DateOnly method info lookups to shar…
roji commentedon Aug 19, 2024
@nikhil197 I believe this is no longer a direction we should go in.
We currently indeed use reflection to look up MethodInfos; some of these patterns are understood by the .NET linker, which then refrains from trimming those methods. In effect, this means that EF's pipeline causes a lot more methods to get preserved, even if they never actually get used by user code, only because they could in theory be used and would need to be translated. This results in binaries that are bigger than they need to be.
The alternative is to use string-based matching, where we look at the name of the method in the query pipline, and also at its DeclaringType. That refrains from directly referencing the method in a way that's visible to the linker.
This work is tracked by #26288; I'll go ahead and close this issue.