Skip to content

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

@rdhainaut

Description

@rdhainaut

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions