Пример #1
0
        public async Task ProcessDeploymentStepAsync(DeploymentStep step, DeploymentPlanResult result)
        {
            if (!(step is ContentDefinitionDeploymentStep contentDefinitionStep))
            {
                return;
            }

            var contentTypeDefinitionRecord = await _contentDefinitionStore.LoadContentDefinitionAsync();

            var contentTypes = contentDefinitionStep.IncludeAll
                ? contentTypeDefinitionRecord.ContentTypeDefinitionRecords
                : contentTypeDefinitionRecord.ContentTypeDefinitionRecords
                               .Where(x => contentDefinitionStep.ContentTypes.Contains(x.Name));

            var contentParts = contentDefinitionStep.IncludeAll
                ? contentTypeDefinitionRecord.ContentPartDefinitionRecords
                : contentTypeDefinitionRecord.ContentPartDefinitionRecords
                               .Where(x => contentDefinitionStep.ContentParts.Contains(x.Name));

            result.Steps.Add(new JObject(
                                 new JProperty("name", "ContentDefinition"),
                                 new JProperty("ContentTypes", JArray.FromObject(contentTypes)),
                                 new JProperty("ContentParts", JArray.FromObject(contentParts))
                                 ));

            return;
        }
Пример #2
0
        private ContentDefinitionRecord GetContentDefinitionRecord()
        {
            if (_contentDefinitionRecord != null)
            {
                return(_contentDefinitionRecord);
            }

            return(_contentDefinitionRecord = _contentDefinitionStore.LoadContentDefinitionAsync().GetAwaiter().GetResult());
        }
 /// <summary>
 /// Returns the document from the store to be updated.
 /// </summary>
 private ContentDefinitionRecord LoadContentDefinitionRecord() =>
 _contentDefinitionStore.LoadContentDefinitionAsync().GetAwaiter().GetResult();