Exemple #1
0
        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();
            }
        }
Exemple #2
0
 protected InstantFeedbackSourceViewModel(Func <int> getCount, IInstantFeedbackSource <TProjection> source)
 {
     this.getCount = getCount;
     this.source   = source;
 }
Exemple #3
0
 public static InstantFeedbackSourceViewModel Create(Func <int> getCount, IInstantFeedbackSource <TProjection> source)
 {
     return(ViewModelSource.Create(() => new InstantFeedbackSourceViewModel(getCount, source)));
 }