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
Clarify that lazy-loading cannot be opted-out of by making a property non-virtual #1607
> EF Core will then enable lazy loading for any navigation property that can be overridden--that is, it must be virtual and on a class that can be inherited from.
The above statement from this docu page seems misleading to me: it hints that navigation properties can be virtual or not, and if they're not virtual, they will simply not be lazy-loaded.
Instead it would seem that if lazy loading is enabled EVERY navigation property on EVERY model of such a db context has to be virtual, because else we will see exceptions being thrown on app startup by .migrate()!
Another: There seem to be some requirements about constructors in models. Queries that used to be working before enabling lazy loading are now throwing because "Can not instatiate proxy of class Blah.Blah Could not find a constructor that would match given arguments."
Because of all of the above it would seem that enabling lazy loading requires some special preparations, far surpassing installing the NuGet package this docu page mentions and adding .UseLazyLoadingProxies() to startup.cs.
I can not see these requirements documented here. I'd suggest mentioning them on this page and either documenting them extensively or linking to a separate docu page where they are described.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
ID: bbd36f35-e257-d0ed-8f28-f539ddcb71ec
Version Independent ID: 093903d5-f7c7-5a78-c0e5-0e2662dcedef
Reacted by Joseph Musser, Ivan Stoev, Diego Baldeschi, timmi4sa, Matteo Contrini, Cleyton Goncalves, matteotrapani, Excel, aquilla12, Mohammed Elghamry and 1 more
changed the title [-]Caveats related to using lazy loading not mentioned[/-][+]Clarify that lazy-loading cannot be opted-out of by making a property non-virtual[/+]on Sep 2, 2019
Activity
[-]Caveats related to using lazy loading not mentioned[/-][+]Clarify that lazy-loading cannot be opted-out of by making a property non-virtual[/+]