Exemplo n.º 1
0
        public Task EnsureCustomEntityDefinitionExistsAsync(string customEntityDefinitionCode, IExecutionContext executionContext = null)
        {
            var command = new EnsureCustomEntityDefinitionExistsCommand()
            {
                CustomEntityDefinitionCode = customEntityDefinitionCode
            };

            return(_commandExecutor.ExecuteAsync(command, executionContext));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Checks that a custom entity definition exists if it is required by the tempate. This
        /// can cause a DbContext.SaveChanges to run.
        /// </summary>
        private Task EnsureCustomEntityDefinitionExists(
            PageTemplateFileInfo fileTemplateDetails,
            PageTemplate dbPageTemplate
            )
        {
            var definitionCode = fileTemplateDetails.CustomEntityDefinition?.CustomEntityDefinitionCode;

            // Only update/check the definition if it has changed to potentially save a query
            if (!string.IsNullOrEmpty(definitionCode) && (dbPageTemplate == null || definitionCode != dbPageTemplate.CustomEntityDefinitionCode))
            {
                var command = new EnsureCustomEntityDefinitionExistsCommand(fileTemplateDetails.CustomEntityDefinition.CustomEntityDefinitionCode);
                return(_commandExecutor.ExecuteAsync(command));
            }

            return(Task.CompletedTask);
        }
        public Task EnsureExistsAsync(string customEntityDefinitionCode)
        {
            var command = new EnsureCustomEntityDefinitionExistsCommand(customEntityDefinitionCode);

            return(ExtendableContentRepository.ExecuteCommandAsync(command));
        }