Skip to content
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

Closed
divega opened this issue Sep 4, 2014 · 7 comments
Closed

Explicit loading support #625

divega opened this issue Sep 4, 2014 · 7 comments
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@divega
Copy link
Contributor

divega commented Sep 4, 2014

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.

@rowanmiller rowanmiller modified the milestone: 1.0.0 Sep 5, 2014
@rowanmiller rowanmiller modified the milestones: Backlog, 7.0.0 Dec 5, 2014
@mjrousos
Copy link
Member

+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.

@techyian
Copy link

+1 for this

@ajcvickers ajcvickers self-assigned this Jul 8, 2016
ajcvickers added a commit that referenced this issue Jul 21, 2016
@ajcvickers ajcvickers modified the milestones: 1.1.0, Backlog Jul 21, 2016
ajcvickers added a commit that referenced this issue Jul 21, 2016
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jul 21, 2016
@arielcloud
Copy link

The docs here reference this issue.
if u close this it means the issue solved? if so - can u fix the docs? thanks!

@rowanmiller
Copy link
Contributor

@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.

ajcvickers added a commit that referenced this issue Jul 25, 2016
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
ajcvickers added a commit that referenced this issue Jul 26, 2016
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
@RickStrahl
Copy link

RickStrahl commented Oct 9, 2016

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; }
}

@divega
Copy link
Contributor Author

divega commented Oct 9, 2016

@RickStrahl I think that is covered by #1985, but please let us know if you have additional feedback.

@RickStrahl
Copy link

Thank you. Yup that looks like it would work.

These options will make life a lot easier for generic code in base repositories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Projects
None yet
Development

No branches or pull requests

7 participants