public GetBookByTitleQueryAggregate() : base(new DomainFramework.DataAccess.RepositoryContext(BookWithPagesConnectionClass.GetConnectionName())) { var context = (DomainFramework.DataAccess.RepositoryContext)RepositoryContext; BookQueryRepository.Register(context); PageQueryRepository.Register(context); GetAllPagesLinkedAggregateQueryOperation = new GetAllLinkedAggregateQueryCollectionOperation <int, Page, PageOutputDto> { GetAllLinkedEntities = (repository, entity, user) => ((PageQueryRepository)repository).GetAllPagesForBook(RootEntity.Id).ToList(), GetAllLinkedEntitiesAsync = async(repository, entity, user) => { var entities = await((PageQueryRepository)repository).GetAllPagesForBookAsync(RootEntity.Id); return(entities.ToList()); }, CreateLinkedQueryAggregate = entity => { if (entity is Page) { return(new GetPageByIdQueryAggregate()); } else { throw new InvalidOperationException(); } } }; QueryOperations.Enqueue(GetAllPagesLinkedAggregateQueryOperation); }
public GetBooksQueryAggregate() : base(new DomainFramework.DataAccess.RepositoryContext(BookWithPagesConnectionClass.GetConnectionName())) { var context = (DomainFramework.DataAccess.RepositoryContext)RepositoryContext; BookQueryRepository.Register(context); PageQueryRepository.Register(context); }