public async Task <IDictionary <int, CustomEntitySummary> > ExecuteAsync(GetCustomEntitySummariesByIdRangeQuery query, IExecutionContext executionContext)
        {
            var dbResults = await QueryAsync(query, executionContext);

            // Validation permissions
            var definitionCodes = dbResults.Select(r => r.CustomEntity.CustomEntityDefinitionCode);

            _permissionValidationService.EnforceCustomEntityPermission <CustomEntityReadPermission>(definitionCodes, executionContext.UserContext);

            var mappedResults = await _customEntitySummaryMapper.MapAsync(dbResults, executionContext);

            return(mappedResults.ToDictionary(r => r.CustomEntityId));
        }
        private async Task <List <CustomEntityPublishStatusQuery> > QueryAsync(GetCustomEntitySummariesByIdRangeQuery query, IExecutionContext executionContext)
        {
            var dbResults = await _dbContext
                            .CustomEntityPublishStatusQueries
                            .AsNoTracking()
                            .Include(e => e.CustomEntityVersion)
                            .ThenInclude(e => e.Creator)
                            .Include(e => e.CustomEntity)
                            .ThenInclude(e => e.Creator)
                            .Where(v => query.CustomEntityIds.Contains(v.CustomEntityId))
                            .FilterActive()
                            .FilterByStatus(PublishStatusQuery.Latest, executionContext.ExecutionDate)
                            .ToListAsync();

            return(dbResults);
        }
コード例 #3
0
        /// <summary>
        /// An id range query for custom entities which returns basic
        /// custom entity information with workflow status and model data for the
        /// latest version. The query is not version-sensitive and is designed to be
        /// used in the admin panel and not in a version-sensitive context such as a
        /// public webpage.
        /// </summary>
        /// <param name="customEntityIds">
        /// Collection of custom entity ids to find. Any ids unable to be
        /// located will not be present in the result.
        /// </param>
        /// <param name="executionContext">Optional execution context to use when executing the query. Useful if you need to temporarily elevate your permission level.</param>
        public Task <IDictionary <int, CustomEntitySummary> > GetCustomEntitySummariesByIdRangeAsync(IEnumerable <int> customEntityIds, IExecutionContext executionContext = null)
        {
            var query = new GetCustomEntitySummariesByIdRangeQuery(customEntityIds);

            return(_queryExecutor.ExecuteAsync(query, executionContext));
        }
コード例 #4
0
        public IContentRepositoryQueryContext <IDictionary <int, CustomEntitySummary> > AsSummaries()
        {
            var query = new GetCustomEntitySummariesByIdRangeQuery(_customEntityIds);

            return(ContentRepositoryQueryContextFactory.Create(query, ExtendableContentRepository));
        }
コード例 #5
0
        public Task <IDictionary <int, CustomEntitySummary> > AsSummariesAsync()
        {
            var query = new GetCustomEntitySummariesByIdRangeQuery(_customEntityIds);

            return(ExtendableContentRepository.ExecuteQueryAsync(query));
        }