Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PublishedContentType"/> class with a content type.
        /// </summary>
        public PublishedContentType(IContentTypeComposition contentType, IPublishedContentTypeFactory factory)
            : this(contentType.Id, contentType.Alias, contentType.GetItemType(), contentType.CompositionAliases(), contentType.Variations, contentType.IsElement)
        {
            var propertyTypes = contentType.CompositionPropertyTypes
                                .Select(x => factory.CreatePropertyType(this, x))
                                .ToList();

            if (ItemType == PublishedItemType.Member)
            {
                EnsureMemberProperties(propertyTypes, factory);
            }

            _propertyTypes = propertyTypes.ToArray();

            InitializeIndexes();
        }