Skip to main content

LookUpEntitiesViewModel<TEntity, TProjection, TPrimaryKey, TUnitOfWork>.Create(IUnitOfWorkFactory<TUnitOfWork>, Func<TUnitOfWork, IReadOnlyRepository<TEntity>>, Func<IRepositoryQuery<TEntity>, IQueryable<TProjection>>) Method

Creates a new instance of LookUpEntitiesViewModel as a POCO view model.

Namespace: DevExpress.Mvvm.ViewModel

Assembly: DevExpress.Mvvm.v23.2.ViewModel.dll

NuGet Package: DevExpress.Scaffolding.Core

Declaration

public static LookUpEntitiesViewModel<TEntity, TProjection, TPrimaryKey, TUnitOfWork> Create(
    IUnitOfWorkFactory<TUnitOfWork> unitOfWorkFactory,
    Func<TUnitOfWork, IReadOnlyRepository<TEntity>> getRepositoryFunc,
    Func<IRepositoryQuery<TEntity>, IQueryable<TProjection>> projection = null
)

Parameters

Name Type Description
unitOfWorkFactory IUnitOfWorkFactory<TUnitOfWork>

A factory used to create a unit of work instance.

getRepositoryFunc Func<TUnitOfWork, IReadOnlyRepository<TEntity>>

A function that returns a repository representing entities of the given type.

Optional Parameters

Name Type Default Description
projection Func<IRepositoryQuery<TEntity>, IQueryable<TProjection>> null

An optional parameter that provides a LINQ function used to customize a query for entities. The parameter, for example, can be used for sorting data and/or for projecting data to a custom type that does not match the repository entity type.

Returns

Type
LookUpEntitiesViewModel<TEntity, TProjection, TPrimaryKey, TUnitOfWork>
See Also