Example #1
0
        public Dictionary <int, CustomEntityRenderSummary> Execute(GetCustomEntityRenderSummariesByIdRangeQuery query, IExecutionContext executionContext)
        {
            var dbResults = Query(query).ToList();

            EnforcePermissions(dbResults, executionContext);
            var results = _customEntityRenderSummaryMapper.MapSummaries(dbResults, executionContext);

            return(results.ToDictionary(r => r.CustomEntityId));
        }
Example #2
0
        public IContentRepositoryQueryContext <IDictionary <int, CustomEntityRenderSummary> > AsRenderSummaries(PublishStatusQuery?publishStatus = null)
        {
            var query = new GetCustomEntityRenderSummariesByIdRangeQuery(_customEntityIds);

            if (publishStatus.HasValue)
            {
                query.PublishStatus = publishStatus.Value;
            }

            return(ContentRepositoryQueryContextFactory.Create(query, ExtendableContentRepository));
        }
Example #3
0
        public Task <IDictionary <int, CustomEntityRenderSummary> > AsRenderSummariesAsync(PublishStatusQuery?publishStatus = null)
        {
            var query = new GetCustomEntityRenderSummariesByIdRangeQuery(_customEntityIds);

            if (publishStatus.HasValue)
            {
                query.PublishStatus = publishStatus.Value;
            }

            return(ExtendableContentRepository.ExecuteQueryAsync(query));
        }
Example #4
0
        private IQueryable <CustomEntityVersion> Query(GetCustomEntityRenderSummariesByIdRangeQuery query)
        {
            var dbQuery = _dbContext
                          .CustomEntityVersions
                          .AsNoTracking()
                          .Where(v => query.CustomEntityIds.Contains(v.CustomEntityId))
                          .FilterByWorkFlowStatusQuery(query.WorkFlowStatus)
                          .Include(e => e.CustomEntity)
                          .Include(e => e.CustomEntity.Locale);

            return(dbQuery);
        }
Example #5
0
        private async Task <List <CustomEntityVersion> > QueryAsync(GetCustomEntityRenderSummariesByIdRangeQuery query, IExecutionContext executionContext)
        {
            if (query.PublishStatus == PublishStatusQuery.SpecificVersion)
            {
                throw new InvalidOperationException("PublishStatusQuery.SpecificVersion not supported in GetCustomEntityRenderSummariesByDefinitionCodeQuery");
            }

            var dbQuery = await _dbContext
                          .CustomEntityPublishStatusQueries
                          .AsNoTracking()
                          .Include(e => e.CustomEntityVersion)
                          .ThenInclude(e => e.CustomEntity)
                          .FilterByActive()
                          .FilterByStatus(query.PublishStatus, executionContext.ExecutionDate)
                          .Where(v => query.CustomEntityIds.Contains(v.CustomEntityId))
                          .ToListAsync();

            return(dbQuery
                   .Select(v => v.CustomEntityVersion)
                   .ToList());
        }
Example #6
0
 public Task <IDictionary <int, CustomEntityRenderSummary> > GetCustomEntityRenderSummariesByIdRangeAsync(GetCustomEntityRenderSummariesByIdRangeQuery query, IExecutionContext executionContext = null)
 {
     return(_queryExecutor.ExecuteAsync(query, executionContext));
 }
Example #7
0
        public async Task <IDictionary <int, CustomEntityRenderSummary> > ExecuteAsync(GetCustomEntityRenderSummariesByIdRangeQuery query, IExecutionContext executionContext)
        {
            var dbResults = await QueryAsync(query, executionContext);

            EnforcePermissions(dbResults, executionContext);
            var results = await _customEntityRenderSummaryMapper.MapAsync(dbResults, executionContext);

            return(results.ToDictionary(r => r.CustomEntityId));
        }