URF.Core
URF.Core copied to clipboard
[question] Why there is a method to load a reference property but not a method to load a collection property from Repository ?
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);
This sounds like a good idea. Would you care to submit a PR?
I will look at this monday :)
#75 it s done