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 LoadProperty method to IRepository, IRepositoryAsync #38

Open
tonysneed opened this issue Dec 24, 2017 · 0 comments
Open

Add LoadProperty method to IRepository, IRepositoryAsync #38

tonysneed opened this issue Dec 24, 2017 · 0 comments

Comments

@tonysneed
Copy link
Collaborator

tonysneed commented Dec 24, 2017

This will load a reference property.

IRepository:

void LoadProperty(TEntity item, Expression<Func<TEntity, object>> property);

IRepositoryAsync:

Task LoadProperty(TEntity item, Expression<Func<TEntity, object>> property);

Repository (.NET Core implementation -- will be different for EF 6.x):

public void LoadProperty(PlexApp item, Expression<Func<PlexApp, object>> property) => _context.Entry(item).Reference(property).Load();

public async Task LoadProperty(PlexApp item, Expression<Func<PlexApp, object>> property) => await _context.Entry(item).Reference(property).LoadAsync();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants