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

Add Eager Loading of Related Sub-Entities #14

Open
ToddThomson opened this issue Aug 26, 2018 · 3 comments
Open

Add Eager Loading of Related Sub-Entities #14

ToddThomson opened this issue Aug 26, 2018 · 3 comments
Assignees
Milestone

Comments

@ToddThomson
Copy link
Member

Prototyping in progress...

@ToddThomson ToddThomson added this to the Beta Release milestone Aug 26, 2018
@ToddThomson ToddThomson mentioned this issue Aug 26, 2018
10 tasks
@ToddThomson
Copy link
Member Author

Lazy, or deferred loading of sub-entities is the default manner in which entities are loaded from the database. There are times when entity loading needs to include sub-entities in a single database query. When you know you need sub-entities up front use eager loading.

ToddThomson added a commit that referenced this issue Aug 27, 2018
@ToddThomson
Copy link
Member Author

Eager loading/fetching will utilize remotion's re-linq eager fetching. Integrating this now...

@ToddThomson
Copy link
Member Author

Eager loading of EntityReference and EntityCollection types will utilize:

  • FetchOne(), FetchMany ( may rename to FetchReference() and FetchCollection() for consistency reasons )

FetchOne

var query = from p in context.Products.FetchOne( p => p.Supplier )
                   select p;
var products = query.ToList<Product>();

FetchMany

var query = from p in context.Products.FetchMany( p => p.Parts )
                   select p;
var products = query.ToList<Product>();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant