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

[question] Why there is a method to load a reference property but not a method to load a collection property from Repository ? #74

Open
rdhainaut opened this issue Apr 25, 2020 · 3 comments
Labels
question Further information is requested

Comments

@rdhainaut
Copy link

I have noticed that there is a "generic" method to load a "reference" property but not a "collection" property in the repository code.
I don t understand why there is a distinction and so no generic method for a collection property ?

Actual code for reference property

public virtual async Task LoadPropertyAsync(TEntity item, Expression<Func<TEntity, object>> property, CancellationToken cancellationToken = default)
            => await Context.Entry(item).Reference(property).LoadAsync(cancellationToken);

A proposition for collection property

public virtual async Task LoadCollectionAsync(TEntity item, Expression<Func<TEntity, IEnumerable<object>>> property, CancellationToken cancellationToken = default)
            => await Context.Entry<TEntity>(item).Collection(property).LoadAsync(cancellationToken);
@rdhainaut rdhainaut changed the title [question] Why there is a method to load Property but not collection from Repository ? [question] Why there is a method to load a reference property but not a method to load a collection property from Repository ? Apr 25, 2020
@tonysneed tonysneed added the question Further information is requested label Apr 25, 2020
@tonysneed
Copy link
Contributor

This sounds like a good idea. Would you care to submit a PR?

@rdhainaut
Copy link
Author

I will look at this monday :)

@rdhainaut
Copy link
Author

#75 it s done

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

No branches or pull requests

2 participants