protected void BuildPropertyGroups(ContentTypeCompositionBase contentType, IEnumerable <PropertyGroup> propertyGroups)
 {
     foreach (PropertyGroup propertyGroup in propertyGroups)
     {
         contentType.PropertyGroups.Add(propertyGroup);
     }
 }
 protected void BuildPropertyTypeIds(ContentTypeCompositionBase contentType, int?propertyTypeIdsIncrementingFrom)
 {
     if (propertyTypeIdsIncrementingFrom.HasValue)
     {
         var i = propertyTypeIdsIncrementingFrom.Value;
         foreach (IPropertyType propertyType in contentType.PropertyTypes)
         {
             propertyType.Id = ++i;
         }
     }
 }
Exemplo n.º 3
0
        protected XElement SerializeCompostions(ContentTypeCompositionBase item)
        {
            var compNode     = new XElement("Compositions");
            var compositions = item.ContentTypeComposition;

            foreach (var composition in compositions.OrderBy(x => x.Alias))
            {
                compNode.Add(new XElement("Composition", composition.Alias,
                                          new XAttribute("Key", composition.Key)));
            }

            return(compNode);
        }
        public static void EnsureAllIds(ContentTypeCompositionBase contentType, int seedId)
        {
            //ensure everything has ids
            contentType.Id = seedId;
            var itemid = seedId + 1;

            foreach (var propertyGroup in contentType.PropertyGroups)
            {
                propertyGroup.Id = itemid++;
            }
            foreach (var propertyType in contentType.PropertyTypes)
            {
                propertyType.Id = itemid++;
            }
        }
        public static void EnsureAllIds(ContentTypeCompositionBase contentType, int seedId)
        {
            // Ensure everything has IDs (it will have if builder is used to create the object, but still useful to reset
            // and ensure there are no clashes).
            contentType.Id = seedId;
            var itemid = seedId + 1;

            foreach (PropertyGroup propertyGroup in contentType.PropertyGroups)
            {
                propertyGroup.Id = itemid++;
            }

            foreach (IPropertyType propertyType in contentType.PropertyTypes)
            {
                propertyType.Id = itemid++;
            }
        }