protected InstantFeedbackCollectionViewModelBase( IUnitOfWorkFactory <TUnitOfWork> unitOfWorkFactory, Func <TUnitOfWork, IRepository <TEntity, TPrimaryKey> > getRepositoryFunc, Func <IRepositoryQuery <TEntity>, IQueryable <TProjection> > projection, Func <bool> canCreateNewEntity = null) { this.unitOfWorkFactory = unitOfWorkFactory; this.canCreateNewEntity = canCreateNewEntity; this.getRepositoryFunc = getRepositoryFunc; this.Projection = projection; this.helperRepository = CreateRepository(); RepositoryExtensions.VerifyProjection(helperRepository, projection); this.source = unitOfWorkFactory.CreateInstantFeedbackSource(getRepositoryFunc, Projection); this.Entities = InstantFeedbackSourceViewModel.Create(() => helperRepository.Count(), source); if (!this.IsInDesignMode()) { OnInitializeInRuntime(); } }
protected InstantFeedbackSourceViewModel(Func <int> getCount, IInstantFeedbackSource <TProjection> source) { this.getCount = getCount; this.source = source; }
public static InstantFeedbackSourceViewModel Create(Func <int> getCount, IInstantFeedbackSource <TProjection> source) { return(ViewModelSource.Create(() => new InstantFeedbackSourceViewModel(getCount, source))); }