コード例 #1
0
        private async Task ValidateIsUniqueAsync(AddPageDirectoryCommand command, IExecutionContext executionContext)
        {
            var query = new IsPageDirectoryPathUniqueQuery();

            query.ParentPageDirectoryId = command.ParentPageDirectoryId;
            query.UrlPath = command.UrlPath;

            var isUnique = await _queryExecutor.ExecuteAsync(query, executionContext);

            if (!isUnique)
            {
                var message = $"A page directory already exists in that parent directory with the path '{command.UrlPath}'";
                throw new UniqueConstraintViolationException(message, "UrlPath", command.UrlPath);
            }
        }
コード例 #2
0
 /// <summary>
 /// Determines if a page directory UrlPath is unique
 /// within its parent directory.
 /// </summary>
 /// <param name="query">The parameters run the query with.</param>
 /// <param name="executionContext">Optional execution context to use when executing the query. Useful if you need to temporarily elevate your permission level.</param>
 /// <returns>True if the path is unique; otherwise false.</returns>
 public Task <bool> IsDirectoryPathUniqueAsync(IsPageDirectoryPathUniqueQuery query, IExecutionContext executionContext = null)
 {
     return(_queryExecutor.ExecuteAsync(query, executionContext));
 }
 public Task <bool> IsPathUniqueAsync(IsPageDirectoryPathUniqueQuery query)
 {
     return(ExtendableContentRepository.ExecuteQueryAsync(query));
 }
コード例 #4
0
 public IContentRepositoryQueryContext <bool> IsPathUnique(IsPageDirectoryPathUniqueQuery query)
 {
     return(ContentRepositoryQueryContextFactory.Create(query, ExtendableContentRepository));
 }