Esempio n. 1
0
		protected ContentTypeBase(IContentTypeBase parent)
		{
			Mandate.ParameterNotNull(parent, "parent");

			_parentId = new Lazy<int>(() => parent.Id);
			_allowedContentTypes = new List<ContentTypeSort>();
			_propertyGroups = new PropertyGroupCollection();
            _propertyTypes = new PropertyTypeCollection();
		}
Esempio n. 2
0
        protected ContentTypeBase(int parentId)
        {
			Mandate.ParameterCondition(parentId != 0, "parentId");

            _parentId = new Lazy<int>(() => parentId);
            _allowedContentTypes = new List<ContentTypeSort>();
            _propertyGroups = new PropertyGroupCollection();
            _propertyTypes = new PropertyTypeCollection();
        }
Esempio n. 3
0
        public static PropertyGroup FindTab(this PropertyGroupCollection groups, string alias)
        {
            var tab = groups.FirstOrDefault(x => x.Alias.InvariantEquals(alias));

            if (tab != null)
            {
                return(tab);
            }

            var tempAlias = GetTempTabAlias(alias);

            tab = groups.FirstOrDefault(x => x.Alias.InvariantEquals(tempAlias));
            if (tab != null)
            {
                return(tab);
            }

            return(null);
        }
Esempio n. 4
0
    public static IEnumerable <PropertyGroup> BuildEntity(
        IEnumerable <PropertyTypeGroupDto> groupDtos,
        bool isPublishing,
        int contentTypeId,
        DateTime createDate,
        DateTime updateDate,
        Func <string?, ValueStorageType, string?, PropertyType> propertyTypeCtor)
    {
        // groupDtos contains all the groups, those that are defined on the current
        // content type, and those that are inherited from composition content types
        var propertyGroups = new PropertyGroupCollection();

        foreach (PropertyTypeGroupDto groupDto in groupDtos)
        {
            var group = new PropertyGroup(isPublishing);

            try
            {
                group.DisableChangeTracking();

                // if the group is defined on the current content type,
                // assign its identifier, else it will be zero
                if (groupDto.ContentTypeNodeId == contentTypeId)
                {
                    group.Id = groupDto.Id;
                }

                group.Key       = groupDto.UniqueId;
                group.Type      = (PropertyGroupType)groupDto.Type;
                group.Name      = groupDto.Text;
                group.Alias     = groupDto.Alias;
                group.SortOrder = groupDto.SortOrder;

                group.PropertyTypes = new PropertyTypeCollection(isPublishing);

                // Because we are likely to have a group with no PropertyTypes we need to ensure that these are excluded
                IEnumerable <PropertyTypeDto> typeDtos = groupDto.PropertyTypeDtos?.Where(x => x.Id > 0) ??
                                                         Enumerable.Empty <PropertyTypeDto>();
                foreach (PropertyTypeDto typeDto in typeDtos)
                {
                    PropertyTypeGroupDto tempGroupDto = groupDto;
                    PropertyType         propertyType = propertyTypeCtor(
                        typeDto.DataTypeDto.EditorAlias,
                        typeDto.DataTypeDto.DbType.EnumParse <ValueStorageType>(true),
                        typeDto.Alias);

                    try
                    {
                        propertyType.DisableChangeTracking();

                        propertyType.Alias                   = typeDto.Alias ?? string.Empty;
                        propertyType.DataTypeId              = typeDto.DataTypeId;
                        propertyType.DataTypeKey             = typeDto.DataTypeDto.NodeDto.UniqueId;
                        propertyType.Description             = typeDto.Description;
                        propertyType.Id                      = typeDto.Id;
                        propertyType.Key                     = typeDto.UniqueId;
                        propertyType.Name                    = typeDto.Name ?? string.Empty;
                        propertyType.Mandatory               = typeDto.Mandatory;
                        propertyType.MandatoryMessage        = typeDto.MandatoryMessage;
                        propertyType.SortOrder               = typeDto.SortOrder;
                        propertyType.ValidationRegExp        = typeDto.ValidationRegExp;
                        propertyType.ValidationRegExpMessage = typeDto.ValidationRegExpMessage;
                        propertyType.PropertyGroupId         = new Lazy <int>(() => tempGroupDto.Id);
                        propertyType.CreateDate              = createDate;
                        propertyType.UpdateDate              = updateDate;
                        propertyType.Variations              = (ContentVariation)typeDto.Variations;

                        // reset dirty initial properties (U4-1946)
                        propertyType.ResetDirtyProperties(false);
                        group.PropertyTypes.Add(propertyType);
                    }
                    finally
                    {
                        propertyType.EnableChangeTracking();
                    }
                }

                // reset dirty initial properties (U4-1946)
                group.ResetDirtyProperties(false);
                propertyGroups.Add(group);
            }
            finally
            {
                group.EnableChangeTracking();
            }
        }

        return(propertyGroups);
    }
        private void MapGroupsAndProperties(IDictionary <int, IContentTypeComposition> contentTypes)
        {
            var sql1 = Sql()
                       .Select <PropertyTypeGroupDto>()
                       .From <PropertyTypeGroupDto>()
                       .InnerJoin <ContentTypeDto>().On <PropertyTypeGroupDto, ContentTypeDto>((ptg, ct) => ptg.ContentTypeNodeId == ct.NodeId)
                       .OrderBy <ContentTypeDto>(x => x.NodeId)
                       .AndBy <PropertyTypeGroupDto>(x => x.SortOrder, x => x.Id);

            var groupDtos = Database.Fetch <PropertyTypeGroupDto>(sql1);

            var sql2 = Sql()
                       .Select <PropertyTypeDto>(r => r.Select(x => x.DataTypeDto, r1 => r1.Select(x => x.NodeDto)))
                       .AndSelect <MemberPropertyTypeDto>()
                       .From <PropertyTypeDto>()
                       .InnerJoin <DataTypeDto>().On <PropertyTypeDto, DataTypeDto>((pt, dt) => pt.DataTypeId == dt.NodeId)
                       .InnerJoin <NodeDto>().On <DataTypeDto, NodeDto>((dt, n) => dt.NodeId == n.NodeId)
                       .InnerJoin <ContentTypeDto>().On <PropertyTypeDto, ContentTypeDto>((pt, ct) => pt.ContentTypeId == ct.NodeId)
                       .LeftJoin <PropertyTypeGroupDto>().On <PropertyTypeDto, PropertyTypeGroupDto>((pt, ptg) => pt.PropertyTypeGroupId == ptg.Id)
                       .LeftJoin <MemberPropertyTypeDto>().On <PropertyTypeDto, MemberPropertyTypeDto>((pt, mpt) => pt.Id == mpt.PropertyTypeId)
                       .OrderBy <ContentTypeDto>(x => x.NodeId)
                       .AndBy <PropertyTypeGroupDto>(x => x.SortOrder, x => x.Id) // NULLs will come first or last, never mind, we deal with it below
                       .AndBy <PropertyTypeDto>(x => x.SortOrder, x => x.Id);

            var propertyDtos      = Database.Fetch <PropertyTypeCommonDto>(sql2);
            var builtinProperties = Constants.Conventions.Member.GetStandardPropertyTypeStubs();

            var groupIx    = 0;
            var propertyIx = 0;

            foreach (var contentType in contentTypes.Values)
            {
                // only IContentType is publishing
                var isPublishing = contentType is IContentType;

                // get group-less properties (in case NULL is ordered first)
                var noGroupPropertyTypes = new PropertyTypeCollection(isPublishing);
                while (propertyIx < propertyDtos.Count && propertyDtos[propertyIx].ContentTypeId == contentType.Id && propertyDtos[propertyIx].PropertyTypeGroupId == null)
                {
                    noGroupPropertyTypes.Add(MapPropertyType(contentType, propertyDtos[propertyIx], builtinProperties));
                    propertyIx++;
                }

                // get groups and their properties
                var groupCollection = new PropertyGroupCollection();
                while (groupIx < groupDtos.Count && groupDtos[groupIx].ContentTypeNodeId == contentType.Id)
                {
                    var group = MapPropertyGroup(groupDtos[groupIx], isPublishing);
                    groupCollection.Add(group);
                    groupIx++;

                    while (propertyIx < propertyDtos.Count && propertyDtos[propertyIx].ContentTypeId == contentType.Id && propertyDtos[propertyIx].PropertyTypeGroupId == group.Id)
                    {
                        group.PropertyTypes.Add(MapPropertyType(contentType, propertyDtos[propertyIx], builtinProperties));
                        propertyIx++;
                    }
                }
                contentType.PropertyGroups = groupCollection;

                // get group-less properties (in case NULL is ordered last)
                while (propertyIx < propertyDtos.Count && propertyDtos[propertyIx].ContentTypeId == contentType.Id && propertyDtos[propertyIx].PropertyTypeGroupId == null)
                {
                    noGroupPropertyTypes.Add(MapPropertyType(contentType, propertyDtos[propertyIx], builtinProperties));
                    propertyIx++;
                }
                contentType.NoGroupPropertyTypes = noGroupPropertyTypes;

                // ensure builtin properties
                if (contentType is MemberType memberType)
                {
                    // ensure that the group exists (ok if it already exists)
                    memberType.AddPropertyGroup(Constants.Conventions.Member.StandardPropertiesGroupName);

                    // ensure that property types exist (ok if they already exist)
                    foreach (var(alias, propertyType) in builtinProperties)
                    {
                        var added = memberType.AddPropertyType(propertyType, Constants.Conventions.Member.StandardPropertiesGroupName);

                        if (added)
                        {
                            var access = new MemberTypePropertyProfileAccess(false, false, false);
                            memberType.MemberTypePropertyTypes[alias] = access;
                        }
                    }
                }
            }
        }
        private static PropertyGroupCollection GetPropertyTypeGroupCollection(MemberTypeReadOnlyDto dto, MemberType memberType, Dictionary <string, PropertyType> standardProps)
        {
            // see PropertyGroupFactory, repeating code here...

            var propertyGroups = new PropertyGroupCollection();

            foreach (var groupDto in dto.PropertyTypeGroups.Where(x => x.Id.HasValue))
            {
                var group = new PropertyGroup(MemberType.IsPublishingConst);

                // if the group is defined on the current member type,
                // assign its identifier, else it will be zero
                if (groupDto.ContentTypeNodeId == memberType.Id)
                {
                    // note: no idea why Id is nullable here, but better check
                    if (groupDto.Id.HasValue == false)
                    {
                        throw new Exception("GroupDto.Id has no value.");
                    }
                    group.Id = groupDto.Id.Value;
                }

                group.Key           = groupDto.UniqueId;
                group.Name          = groupDto.Text;
                group.SortOrder     = groupDto.SortOrder;
                group.PropertyTypes = new PropertyTypeCollection(MemberType.IsPublishingConst);

                //Because we are likely to have a group with no PropertyTypes we need to ensure that these are excluded
                var localGroupDto = groupDto;
                var typeDtos      = dto.PropertyTypes.Where(x => x.Id.HasValue && x.Id > 0 && x.PropertyTypeGroupId.HasValue && x.PropertyTypeGroupId.Value == localGroupDto.Id.Value);
                foreach (var typeDto in typeDtos)
                {
                    //Internal dictionary for adding "MemberCanEdit" and "VisibleOnProfile" properties to each PropertyType
                    memberType.MemberTypePropertyTypes.Add(typeDto.Alias,
                                                           new MemberTypePropertyProfileAccess(typeDto.ViewOnProfile, typeDto.CanEdit, typeDto.IsSensitive));

                    var tempGroupDto = groupDto;

                    //ensures that any built-in membership properties have their correct dbtype assigned no matter
                    //what the underlying data type is
                    var propDbType = MemberTypeRepository.GetDbTypeForBuiltInProperty(
                        typeDto.Alias,
                        typeDto.DbType.EnumParse <ValueStorageType>(true),
                        standardProps);

                    var propertyType = new PropertyType(
                        typeDto.PropertyEditorAlias,
                        propDbType.Result,
                        //This flag tells the property type that it has an explicit dbtype and that it cannot be changed
                        // which is what we want for the built-in properties.
                        propDbType.Success,
                        typeDto.Alias)
                    {
                        DataTypeId       = typeDto.DataTypeId,
                        Description      = typeDto.Description,
                        Id               = typeDto.Id.Value,
                        Name             = typeDto.Name,
                        Mandatory        = typeDto.Mandatory,
                        SortOrder        = typeDto.SortOrder,
                        ValidationRegExp = typeDto.ValidationRegExp,
                        PropertyGroupId  = new Lazy <int>(() => tempGroupDto.Id.Value),
                        CreateDate       = memberType.CreateDate,
                        UpdateDate       = memberType.UpdateDate,
                        Key              = typeDto.UniqueId
                    };

                    // reset dirty initial properties (U4-1946)
                    propertyType.ResetDirtyProperties(false);
                    group.PropertyTypes.Add(propertyType);
                }

                // reset dirty initial properties (U4-1946)
                group.ResetDirtyProperties(false);
                propertyGroups.Add(group);
            }

            return(propertyGroups);
        }
Esempio n. 7
0
        private PropertyGroupCollection GetPropertyTypeGroupCollection(MemberTypeReadOnlyDto dto, MemberType memberType, Dictionary <string, PropertyType> standardProps)
        {
            var propertyGroups = new PropertyGroupCollection();

            foreach (var groupDto in dto.PropertyTypeGroups.Where(x => x.Id.HasValue))
            {
                var group = new PropertyGroup();

                //Only assign an Id if the PropertyGroup belongs to this ContentType
                if (groupDto.ContentTypeNodeId == memberType.Id)
                {
                    group.Id = groupDto.Id.Value;

                    if (groupDto.ParentGroupId.HasValue)
                    {
                        group.ParentId = groupDto.ParentGroupId.Value;
                    }
                }
                else
                {
                    //If the PropertyGroup is inherited, we add a reference to the group as a Parent.
                    group.ParentId = groupDto.Id;
                }

                group.Name          = groupDto.Text;
                group.SortOrder     = groupDto.SortOrder;
                group.PropertyTypes = new PropertyTypeCollection();

                //Because we are likely to have a group with no PropertyTypes we need to ensure that these are excluded
                var localGroupDto = groupDto;
                var typeDtos      = dto.PropertyTypes.Where(x => x.Id.HasValue && x.Id > 0 && x.PropertyTypeGroupId.HasValue && x.PropertyTypeGroupId.Value == localGroupDto.Id.Value);
                foreach (var typeDto in typeDtos)
                {
                    //Internal dictionary for adding "MemberCanEdit" and "VisibleOnProfile" properties to each PropertyType
                    memberType.MemberTypePropertyTypes.Add(typeDto.Alias,
                                                           new MemberTypePropertyProfileAccess(typeDto.ViewOnProfile, typeDto.CanEdit));

                    var tempGroupDto = groupDto;

                    //ensures that any built-in membership properties have their correct dbtype assigned no matter
                    //what the underlying data type is
                    var propDbType = MemberTypeRepository.GetDbTypeForBuiltInProperty(
                        typeDto.Alias,
                        typeDto.DbType.EnumParse <DataTypeDatabaseType>(true),
                        standardProps);

                    var propertyType = new PropertyType(
                        typeDto.PropertyEditorAlias,
                        propDbType.Result,
                        //This flag tells the property type that it has an explicit dbtype and that it cannot be changed
                        // which is what we want for the built-in properties.
                        propDbType.Success,
                        typeDto.Alias)
                    {
                        DataTypeDefinitionId = typeDto.DataTypeId,
                        Description          = typeDto.Description,
                        Id               = typeDto.Id.Value,
                        Name             = typeDto.Name,
                        Mandatory        = typeDto.Mandatory,
                        SortOrder        = typeDto.SortOrder,
                        ValidationRegExp = typeDto.ValidationRegExp,
                        PropertyGroupId  = new Lazy <int>(() => tempGroupDto.Id.Value),
                        CreateDate       = memberType.CreateDate,
                        UpdateDate       = memberType.UpdateDate
                    };
                    //on initial construction we don't want to have dirty properties tracked
                    // http://issues.umbraco.org/issue/U4-1946
                    propertyType.ResetDirtyProperties(false);
                    group.PropertyTypes.Add(propertyType);
                }
                //on initial construction we don't want to have dirty properties tracked
                // http://issues.umbraco.org/issue/U4-1946
                group.ResetDirtyProperties(false);
                propertyGroups.Add(group);
            }

            return(propertyGroups);
        }
Esempio n. 8
0
        private PropertyGroupCollection GetPropertyTypeGroupCollection(MemberTypeReadOnlyDto dto, MemberType memberType)
        {
            var propertyGroups = new PropertyGroupCollection();

            foreach (var groupDto in dto.PropertyTypeGroups.Where(x => x.Id.HasValue))
            {
                var group = new PropertyGroup();
                //Only assign an Id if the PropertyGroup belongs to this ContentType
                if (groupDto.ContentTypeNodeId == memberType.Id)
                {
                    group.Id = groupDto.Id.Value;

                    if (groupDto.ParentGroupId.HasValue)
                    {
                        group.ParentId = groupDto.ParentGroupId.Value;
                    }
                }
                else
                {
                    //If the PropertyGroup is inherited, we add a reference to the group as a Parent.
                    group.ParentId = groupDto.Id;
                }

                group.Name          = groupDto.Text;
                group.SortOrder     = groupDto.SortOrder;
                group.PropertyTypes = new PropertyTypeCollection();

                //Because we are likely to have a group with no PropertyTypes we need to ensure that these are excluded
                var localGroupDto = groupDto;
                var typeDtos      = dto.PropertyTypes.Where(x => x.Id.HasValue && x.Id > 0 && x.PropertyTypeGroupId.HasValue && x.PropertyTypeGroupId.Value == localGroupDto.Id.Value);
                foreach (var typeDto in typeDtos)
                {
                    //Internal dictionary for adding "MemberCanEdit" and "VisibleOnProfile" properties to each PropertyType
                    memberType.MemberTypePropertyTypes.Add(typeDto.Alias,
                                                           new Tuple <bool, bool, int>(typeDto.CanEdit, typeDto.ViewOnProfile, typeDto.Id.Value));

                    var tempGroupDto = groupDto;
                    var propertyType = new PropertyType(typeDto.ControlId,
                                                        typeDto.DbType.EnumParse <DataTypeDatabaseType>(true))
                    {
                        Alias = typeDto.Alias,
                        DataTypeDefinitionId = typeDto.DataTypeId,
                        Description          = typeDto.Description,
                        Id               = typeDto.Id.Value,
                        Name             = typeDto.Name,
                        HelpText         = typeDto.HelpText,
                        Mandatory        = typeDto.Mandatory,
                        SortOrder        = typeDto.SortOrder,
                        ValidationRegExp = typeDto.ValidationRegExp,
                        PropertyGroupId  = new Lazy <int>(() => tempGroupDto.Id.Value),
                        CreateDate       = memberType.CreateDate,
                        UpdateDate       = memberType.UpdateDate
                    };
                    //on initial construction we don't want to have dirty properties tracked
                    // http://issues.umbraco.org/issue/U4-1946
                    propertyType.ResetDirtyProperties(false);
                    group.PropertyTypes.Add(propertyType);
                }
                //on initial construction we don't want to have dirty properties tracked
                // http://issues.umbraco.org/issue/U4-1946
                group.ResetDirtyProperties(false);
                propertyGroups.Add(group);
            }

            return(propertyGroups);
        }
Esempio n. 9
0
 protected override PropertyGroupViewModel CreatePropertyGroup(string tag, string translatedTag, PropertyGroupCollection lst)
 {
     if (tag == "Properties" && (_dataType is ObjectClass || _dataType is CompoundObject))
     {
         return ViewModelFactory.CreateViewModel<MultiplePropertyGroupViewModel.Factory>()
             .Invoke(
                 DataContext,
                 this,
                 tag,
                 translatedTag,
                 lst.Concat(new[] {
                        ViewModelFactory.CreateViewModel<LabeledViewContainerViewModel.Factory>().Invoke(DataContext, this, "Preview", "", ViewModelFactory.CreateViewModel<PropertiesPrewiewViewModel.Factory>().Invoke(DataContext, this, _dataType))
                    })
                    .ToArray());
     }
     else if (tag == "GUI")
     {
         return ViewModelFactory.CreateViewModel<CustomPropertyGroupViewModel.Factory>()
             .Invoke(
                 DataContext,
                 this,
                 tag,
                 translatedTag,
                 new[] {
                     ViewModelFactory.CreateViewModel<StackPanelViewModel.Factory>()
                         .Invoke(
                             DataContext,
                             this,
                             tag,
                             new[] {
                                 ViewModelFactory.CreateViewModel<GroupBoxViewModel.Factory>().Invoke(DataContext, this, "Settings", lst.GetWithKeys().Where(kv => !kv.Key.StartsWith("Show")).Select(kv => kv.Value)),
                                 ViewModelFactory.CreateViewModel<GroupBoxViewModel.Factory>().Invoke(DataContext, this, "Display", lst.GetWithKeys().Where(kv => kv.Key.StartsWith("Show")).Select(kv => kv.Value)),
                             })
                 });
     }
     else
     {
         return base.CreatePropertyGroup(tag, translatedTag, lst);
     }
 }
Esempio n. 10
0
        public IEnumerable <PropertyGroup> BuildEntity(IEnumerable <PropertyTypeGroupDto> dto)
        {
            var propertyGroups = new PropertyGroupCollection();

            foreach (var groupDto in dto)
            {
                var group = new PropertyGroup();
                //Only assign an Id if the PropertyGroup belongs to this ContentType
                if (groupDto.ContentTypeNodeId == _id)
                {
                    group.Id = groupDto.Id;

                    if (groupDto.ParentGroupId.HasValue)
                    {
                        group.ParentId = groupDto.ParentGroupId.Value;
                    }
                }
                else
                {
                    //If the PropertyGroup is inherited, we add a reference to the group as a Parent.
                    group.ParentId = groupDto.Id;
                }

                group.Name          = groupDto.Text;
                group.SortOrder     = groupDto.SortOrder;
                group.PropertyTypes = new PropertyTypeCollection();

                //Because we are likely to have a group with no PropertyTypes we need to ensure that these are excluded
                var typeDtos = groupDto.PropertyTypeDtos.Where(x => x.Id > 0);
                foreach (var typeDto in typeDtos)
                {
                    var tempGroupDto = groupDto;
                    var propertyType = _propertyTypeCtor(typeDto.DataTypeDto.PropertyEditorAlias,
                                                         typeDto.DataTypeDto.DbType.EnumParse <DataTypeDatabaseType>(true),
                                                         typeDto.Alias);

                    propertyType.Alias = typeDto.Alias;
                    propertyType.DataTypeDefinitionId = typeDto.DataTypeId;
                    propertyType.Description          = typeDto.Description;
                    propertyType.Id               = typeDto.Id;
                    propertyType.Key              = typeDto.UniqueId;
                    propertyType.Name             = typeDto.Name;
                    propertyType.Mandatory        = typeDto.Mandatory;
                    propertyType.SortOrder        = typeDto.SortOrder;
                    propertyType.ValidationRegExp = typeDto.ValidationRegExp;
                    propertyType.PropertyGroupId  = new Lazy <int>(() => tempGroupDto.Id);
                    propertyType.CreateDate       = _createDate;
                    propertyType.UpdateDate       = _updateDate;

                    //on initial construction we don't want to have dirty properties tracked
                    // http://issues.umbraco.org/issue/U4-1946
                    propertyType.ResetDirtyProperties(false);
                    group.PropertyTypes.Add(propertyType);
                }
                //on initial construction we don't want to have dirty properties tracked
                // http://issues.umbraco.org/issue/U4-1946
                group.ResetDirtyProperties(false);
                propertyGroups.Add(group);
            }

            return(propertyGroups);
        }
        public IEnumerable <PropertyGroup> BuildEntity(IEnumerable <PropertyTypeGroupDto> groupDtos)
        {
            // groupDtos contains all the groups, those that are defined on the current
            // content type, and those that are inherited from composition content types
            var propertyGroups = new PropertyGroupCollection();

            foreach (var groupDto in groupDtos)
            {
                var group = new PropertyGroup();

                try
                {
                    group.DisableChangeTracking();

                    // if the group is defined on the current content type,
                    // assign its identifier, else it will be zero
                    if (groupDto.ContentTypeNodeId == _contentTypeId)
                    {
                        group.Id = groupDto.Id;
                    }

                    group.Name          = groupDto.Text;
                    group.SortOrder     = groupDto.SortOrder;
                    group.PropertyTypes = new PropertyTypeCollection();
                    group.Key           = groupDto.UniqueId;

                    //Because we are likely to have a group with no PropertyTypes we need to ensure that these are excluded
                    var typeDtos = groupDto.PropertyTypeDtos.Where(x => x.Id > 0);
                    foreach (var typeDto in typeDtos)
                    {
                        var tempGroupDto = groupDto;
                        var propertyType = _propertyTypeCtor(typeDto.DataTypeDto.PropertyEditorAlias,
                                                             typeDto.DataTypeDto.DbType.EnumParse <DataTypeDatabaseType>(true),
                                                             typeDto.Alias);

                        try
                        {
                            propertyType.DisableChangeTracking();

                            propertyType.Alias = typeDto.Alias;
                            propertyType.DataTypeDefinitionId = typeDto.DataTypeId;
                            propertyType.Description          = typeDto.Description;
                            propertyType.Id               = typeDto.Id;
                            propertyType.Key              = typeDto.UniqueId;
                            propertyType.Name             = typeDto.Name;
                            propertyType.Mandatory        = typeDto.Mandatory;
                            propertyType.SortOrder        = typeDto.SortOrder;
                            propertyType.ValidationRegExp = typeDto.ValidationRegExp;
                            propertyType.PropertyGroupId  = new Lazy <int>(() => tempGroupDto.Id);
                            propertyType.CreateDate       = _createDate;
                            propertyType.UpdateDate       = _updateDate;

                            //on initial construction we don't want to have dirty properties tracked
                            // http://issues.umbraco.org/issue/U4-1946
                            propertyType.ResetDirtyProperties(false);
                            group.PropertyTypes.Add(propertyType);
                        }
                        finally
                        {
                            propertyType.EnableChangeTracking();
                        }
                    }
                    //on initial construction we don't want to have dirty properties tracked
                    // http://issues.umbraco.org/issue/U4-1946
                    group.ResetDirtyProperties(false);
                    propertyGroups.Add(group);
                }
                finally
                {
                    group.EnableChangeTracking();
                }
            }

            return(propertyGroups);
        }
Esempio n. 12
0
 public TabDiffgram(TabConfiguration configuration, PropertyGroupCollection propertyGroups, ServiceContext serviceContext)
     : base(configuration, serviceContext)
 {
     this.propertyGroups = propertyGroups;
     Properties          = new Dictionary <string, PropertyTypeDiffgram>();
 }
Esempio n. 13
0
 protected override PropertyGroupViewModel CreatePropertyGroup(string tag, string translatedTag, PropertyGroupCollection lst)
 {
     return base.CreatePropertyGroup(tag, translatedTag, lst);
 }