URF.Core icon indicating copy to clipboard operation
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 ?

Open rdhainaut opened this issue 4 years ago • 3 comments

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 avatar Apr 25 '20 18:04 rdhainaut

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

tonysneed avatar Apr 25 '20 22:04 tonysneed

I will look at this monday :)

rdhainaut avatar Apr 25 '20 23:04 rdhainaut

#75 it s done

rdhainaut avatar Jun 02 '20 13:06 rdhainaut