-
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
Explicit loading support #625
Comments
+1; I've recently been porting some old EF6 code which used lazy loading and while I'm ok with not using lazy loading in the new world, some of the models are too large to entirely eagerly load. Instead, I have to explicitly load related objects as they're needed. Having first-class support for this with APIs like Load() and LoadAsync() would make porting easier. |
+1 for this |
Modeled closely on the EF6 APIs Issue #625
Modeled closely on the EF6 APIs Issue #625
The docs here reference this issue. |
@arielcloud it's fixed in our working code base, but not in the current stable release. We will update the docs when this is released in 1.1. |
Set when an entity is loaded with Include or one Load, regardless of whether or not there are any related entities or not. Always true for reference navigation properties on tracked entities when the reference is non-null. Issue #625
Set when an entity is loaded with Include or one Load, regardless of whether or not there are any related entities or not. Always true for reference navigation properties on tracked entities when the reference is non-null. Issue #625
Looking at this it occurs to me that it would be nice to have a model attribute that would allow you to specify that related entities or collections should always be included. This would greatly mitigate the need for lazy or even explicit loading in many situations. It'd be nice if you could just say: public class Album
{
...
[Include]
public Artist Artist {get; set;}
[Include]
public Track[] Tracks {get; set; }
} |
@RickStrahl I think that is covered by #1985, but please let us know if you have additional feedback. |
Thank you. Yup that looks like it would work. These options will make life a lot easier for generic code in base repositories. |
Explicitly triggering the loading of associated data through a navigation can be handy especially when loading across aggregate bondaries or when working with stores that are not natively aggregate oriented. In previous versions of EF we had such methods as Load() and LoadAsync() on reference and collection property entries. We also had handy Query() methods that returned the query we would use to load the data so that filters could be composed over them before executing them. We should have the equivalent functionality in EF7.
The text was updated successfully, but these errors were encountered: