From 45dabd6293a37c5bdb72b630b83897c53540fe09 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 5 Sep 2013 18:38:54 +1000 Subject: [PATCH] Lots of work on U4-2722 Change Property Editors over to use unique alias instead of GUID it compiles but i haven't had time to test anything yet, will start all unit testing/fixing tomorrow, just needed to save this work somewhere. --- src/Umbraco.Core/Constants-PropertyEditors.cs | 505 ++++++++++++------ src/Umbraco.Core/Models/ContentExtensions.cs | 3 +- src/Umbraco.Core/Models/DataTypeDefinition.cs | 41 +- .../Models/IDataTypeDefinition.cs | 6 + src/Umbraco.Core/Models/PropertyType.cs | 48 +- src/Umbraco.Core/Models/Rdbms/DataTypeDto.cs | 4 +- .../Models/Rdbms/PropertyDataReadOnlyDto.cs | 4 +- src/Umbraco.Core/Models/UmbracoEntity.cs | 2 +- .../Factories/DataTypeDefinitionFactory.cs | 4 +- .../Factories/PropertyGroupFactory.cs | 2 +- .../Factories/UmbracoEntityFactory.cs | 4 +- .../LegacyPropertyEditorIdToAliasConverter.cs | 79 +++ .../Mappers/DataTypeDefinitionMapper.cs | 2 +- .../Persistence/Mappers/PropertyTypeMapper.cs | 2 +- .../Migrations/Initial/BaseDataCreation.cs | 48 +- .../ChangeControlIdColumn.cs | 20 + .../Repositories/ContentRepository.cs | 4 +- .../Repositories/ContentTypeBaseRepository.cs | 4 +- .../Repositories/EntityRepository.cs | 10 +- .../Repositories/MediaRepository.cs | 4 +- .../Repositories/MemberRepository.cs | 2 +- .../Repositories/RecycleBinRepository.cs | 6 +- .../IPropertyEditorValueConverter.cs | 14 +- src/Umbraco.Core/Services/ContentService.cs | 9 +- src/Umbraco.Core/Services/DataTypeService.cs | 14 +- src/Umbraco.Core/Services/IDataTypeService.cs | 12 +- src/Umbraco.Core/Services/PackagingService.cs | 4 +- src/Umbraco.Core/Umbraco.Core.csproj | 2 + src/Umbraco.Tests/Models/ContentTests.cs | 22 +- .../Models/DataValueSetterTests.cs | 6 +- .../Mapping/ContentWebModelMappingTests.cs | 4 +- .../Mappers/DataTypeDefinitionMapperTest.cs | 6 +- .../Repositories/ContentTypeRepositoryTest.cs | 10 +- .../Repositories/MediaTypeRepositoryTest.cs | 2 +- .../PublishedContent/PublishedMediaTests.cs | 2 +- .../Services/ContentTypeServiceTests.cs | 12 +- .../Services/EntityServiceTests.cs | 2 +- .../Entities/MockedContentTypes.cs | 92 ++-- .../WebServices/FolderBrowserService.cs | 2 +- .../umbraco/Trees/BaseMediaTree.cs | 12 +- .../datatype/DataTypeDefinition.cs | 16 +- 41 files changed, 716 insertions(+), 331 deletions(-) create mode 100644 src/Umbraco.Core/Persistence/LegacyPropertyEditorIdToAliasConverter.cs create mode 100644 src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/ChangeControlIdColumn.cs diff --git a/src/Umbraco.Core/Constants-PropertyEditors.cs b/src/Umbraco.Core/Constants-PropertyEditors.cs index 60e5ddfd04..21a1f33e6a 100644 --- a/src/Umbraco.Core/Constants-PropertyEditors.cs +++ b/src/Umbraco.Core/Constants-PropertyEditors.cs @@ -1,191 +1,392 @@ -namespace Umbraco.Core +using System; + +namespace Umbraco.Core { public static partial class Constants - { - /// - /// Defines the identifiers for Umbraco Property Editors as constants for easy centralized access/management. - /// - public static class PropertyEditors - { - /// - /// Used to prefix generic properties that are internal content properties - /// - public const string InternalGenericPropertiesPrefix = "_umb_"; + { + /// + /// Defines the identifiers for Umbraco Property Editors as constants for easy centralized access/management. + /// + public static class PropertyEditors + { + /// + /// Used to prefix generic properties that are internal content properties + /// + public const string InternalGenericPropertiesPrefix = "_umb_"; - /// - /// Guid for the Checkbox list datatype. - /// - public const string CheckBoxList = "B4471851-82B6-4C75-AFA4-39FA9C6A75E9"; + /// + /// Guid for the Checkbox list datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string CheckBoxList = "B4471851-82B6-4C75-AFA4-39FA9C6A75E9"; - /// - /// Guid for the Color Picker datatype. - /// - public const string ColorPicker = "F8D60F68-EC59-4974-B43B-C46EB5677985"; + /// + /// Alias for Checkbox list datatype. + /// + public const string CheckBoxListAlias = "Umbraco.CheckBoxList"; - /// - /// Guid for the Content Picker datatype. - /// - public const string ContentPicker = "158AA029-24ED-4948-939E-C3DA209E5FBA"; + /// + /// Guid for the Color Picker datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string ColorPicker = "F8D60F68-EC59-4974-B43B-C46EB5677985"; - /// - /// Guid for the Date datatype. - /// - public const string Date = "23E93522-3200-44E2-9F29-E61A6FCBB79A"; + /// + /// Alias for the Color Picker datatype. + /// + public const string ColorPickerAlias = "Umbraco.ColorPickerAlias"; - /// - /// Guid for the Date/Time datatype. - /// - public const string DateTime = "B6FB1622-AFA5-4BBF-A3CC-D9672A442222"; + /// + /// Guid for the Content Picker datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string ContentPicker = "158AA029-24ED-4948-939E-C3DA209E5FBA"; - /// - /// Guid for the Dictionary Picker datatype. - /// - public const string DictionaryPicker = "17B70066-F764-407D-AB05-3717F1E1C513"; + /// + /// Alias for the Content Picker datatype. + /// + public const string ContentPickerAlias = "Umbraco.ContentPickerAlias"; - /// - /// Guid for the Dropdown list datatype. - /// - public const string DropDownList = "A74EA9C9-8E18-4D2A-8CF6-73C6206C5DA6"; + /// + /// Guid for the Date datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string Date = "23E93522-3200-44E2-9F29-E61A6FCBB79A"; - /// - /// Guid for the Dropdown list multiple datatype. - /// - public const string DropDownListMultiple = "928639ED-9C73-4028-920C-1E55DBB68783"; + /// + /// Alias for the Date datatype. + /// + public const string DateAlias = "Umbraco.Date"; - /// - /// Guid for the Dropdown list multiple, publish keys datatype. - /// - public const string DropdownlistMultiplePublishKeys = "928639AA-9C73-4028-920C-1E55DBB68783"; + /// + /// Guid for the Date/Time datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string DateTime = "B6FB1622-AFA5-4BBF-A3CC-D9672A442222"; - /// - /// Guid for the Dropdown list, publishing keys datatype. - /// - public const string DropdownlistPublishingKeys = "A74EA9E1-8E18-4D2A-8CF6-73C6206C5DA6"; + /// + /// Alias for the Date/Time datatype. + /// + public const string DateTimeAlias = "Umbraco.DateTime"; - /// - /// Guid for the Folder browser datatype. - /// - public const string FolderBrowser = "CCCD4AE9-F399-4ED2-8038-2E88D19E810C"; + /// + /// Guid for the Dictionary Picker datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string DictionaryPicker = "17B70066-F764-407D-AB05-3717F1E1C513"; - /// - /// Guid for the Image Cropper datatype. - /// - public const string ImageCropper = "7A2D436C-34C2-410F-898F-4A23B3D79F54"; + /// + /// Alias for the Dictionary Picker datatype. + /// + public const string DictionaryPickerAlias = "Umbraco.DictionaryPicker"; - /// - /// Guid for the Integer datatype. - /// - public const string Integer = "1413AFCB-D19A-4173-8E9A-68288D2A73B8"; + /// + /// Guid for the Dropdown list datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string DropDownList = "A74EA9C9-8E18-4D2A-8CF6-73C6206C5DA6"; - /// - /// Guid for the Macro Container datatype. - /// - public const string MacroContainer = "474FCFF8-9D2D-11DE-ABC6-AD7A56D89593"; + /// + /// Alias for the Dropdown list datatype. + /// + public const string DropDownListAlias = "Umbraco.DropDown"; - /// - /// Guid for the Media Picker datatype. - /// - public const string MediaPicker = "EAD69342-F06D-4253-83AC-28000225583B"; + /// + /// Guid for the Dropdown list multiple datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string DropDownListMultiple = "928639ED-9C73-4028-920C-1E55DBB68783"; - /// - /// Guid for the Member Picker datatype. - /// - public const string MemberPicker = "39F533E4-0551-4505-A64B-E0425C5CE775"; + /// + /// Alias for the Dropdown list multiple datatype. + /// + public const string DropDownListMultipleAlias = "Umbraco.DropDownMultiple"; - /// - /// Guid for the Multi-Node Tree Picker datatype - /// - public const string MultiNodeTreePicker = "7E062C13-7C41-4AD9-B389-41D88AEEF87C"; + /// + /// Guid for the Dropdown list multiple, publish keys datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string DropdownlistMultiplePublishKeys = "928639AA-9C73-4028-920C-1E55DBB68783"; - /// - /// Guid for the Multiple Textstring datatype. - /// - public const string MultipleTextstring = "5359AD0B-06CC-4182-92BD-0A9117448D3F"; + /// + /// Alias for the Dropdown list multiple, publish keys datatype. + /// + public const string DropdownlistMultiplePublishKeysAlias = "Umbraco.DropdownlistMultiplePublishKeys"; - /// - /// Guid for the No edit datatype. - /// - public const string NoEdit = "6C738306-4C17-4D88-B9BD-6546F3771597"; + /// + /// Guid for the Dropdown list, publishing keys datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string DropdownlistPublishingKeys = "A74EA9E1-8E18-4D2A-8CF6-73C6206C5DA6"; - /// - /// Guid for the Picker Relations datatype. - /// - public const string PickerRelations = "83396FF2-2E39-4A90-9066-17F5F3989374"; + /// + /// Alias for the Dropdown list, publishing keys datatype. + /// + public const string DropdownlistPublishingKeysAlias = "Umbraco.DropdownlistPublishingKeys"; - /// - /// Guid for the Radiobutton list datatype. - /// - public const string RadioButtonList = "A52C7C1C-C330-476E-8605-D63D3B84B6A6"; + /// + /// Guid for the Folder browser datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string FolderBrowser = "CCCD4AE9-F399-4ED2-8038-2E88D19E810C"; - /// - /// Guid for the Related Links datatype. - /// - public const string RelatedLinks = "71B8AD1A-8DC2-425C-B6B8-FAA158075E63"; + /// + /// Alias for the Folder browser datatype. + /// + public const string FolderBrowserAlias = "Umbraco.FolderBrowser"; - /// - /// Guid for the Slider datatype. - /// - public const string Slider = "29E790E6-26B3-438A-B21F-908663A0B19E"; + /// + /// Guid for the Image Cropper datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string ImageCropper = "7A2D436C-34C2-410F-898F-4A23B3D79F54"; - /// - /// Guid for the Tags datatype. - /// - public const string Tags = "4023E540-92F5-11DD-AD8B-0800200C9A66"; + /// + /// Alias for the Image Cropper datatype. + /// + public const string ImageCropperAlias = "Umbraco.ImageCropper"; - /// - /// Guid for the Textbox datatype. - /// - public const string Textbox = "EC15C1E5-9D90-422A-AA52-4F7622C63BEA"; + /// + /// Guid for the Integer datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string Integer = "1413AFCB-D19A-4173-8E9A-68288D2A73B8"; - /// - /// Guid for the Textbox multiple datatype. - /// - public const string TextboxMultiple = "67DB8357-EF57-493E-91AC-936D305E0F2A"; + /// + /// Alias for the Integer datatype. + /// + public const string IntegerAlias = "Umbraco.Integer"; - /// - /// Guid for the TinyMCE v3 wysiwyg datatype. - /// - public const string TinyMCEv3 = "5E9B75AE-FACE-41C8-B47E-5F4B0FD82F83"; + /// + /// Guid for the Macro Container datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string MacroContainer = "474FCFF8-9D2D-11DE-ABC6-AD7A56D89593"; - /// - /// Guid for the TinyMCE wysiwyg (deprecated, upgrade to tinymce v3!) datatype. - /// - public const string TinyMCE = "83722133-F80C-4273-BDB6-1BEFAA04A612"; + /// + /// Alias for the Macro Container datatype. + /// + public const string MacroContainerAlias = "Umbraco.MacroContainer"; - /// - /// Guid for the True/False (Ja/Nej) datatype. - /// - public const string TrueFalse = "38B352C1-E9F8-4FD8-9324-9A2EAB06D97A"; + /// + /// Guid for the Media Picker datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string MediaPicker = "EAD69342-F06D-4253-83AC-28000225583B"; - /// - /// Guid for the Ultimate Picker datatype. - /// - public const string UltimatePicker = "CDBF0B5D-5CB2-445F-BC12-FCAAEC07CF2C"; + /// + /// Alias for the Media Picker datatype. + /// + public const string MediaPickerAlias = "Umbraco.MediaPicker"; - /// - /// Guid for the UltraSimpleEditor datatype. - /// - public const string UltraSimpleEditor = "60B7DABF-99CD-41EB-B8E9-4D2E669BBDE9"; + /// + /// Guid for the Member Picker datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string MemberPicker = "39F533E4-0551-4505-A64B-E0425C5CE775"; - /// - /// Guid for the Umbraco Usercontrol Wrapper datatype. - /// - public const string UmbracoUserControlWrapper = "D15E1281-E456-4B24-AA86-1DDA3E4299D5"; + /// + /// Alias for the Member Picker datatype. + /// + public const string MemberPickerAlias = "Umbraco.MemberPicker"; - /// - /// Guid for the Upload field datatype. - /// - public const string UploadField = "5032A6E6-69E3-491D-BB28-CD31CD11086C"; + /// + /// Guid for the Multi-Node Tree Picker datatype + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string MultiNodeTreePicker = "7E062C13-7C41-4AD9-B389-41D88AEEF87C"; - /// - /// Guid for the XPath CheckBoxList datatype. - /// - public const string XPathCheckBoxList = "34451D92-D270-49BA-8C7F-EE55BFEEE1CB"; + /// + /// Alias for the Multi-Node Tree Picker datatype + /// + public const string MultiNodeTreePickerAlias = "Umbraco.MultiNodeTreePicker"; - /// - /// Guid for the XPath DropDownList datatype. - /// - public const string XPathDropDownList = "173A96AE-00ED-4A7C-9F76-4B53D4A0A1B9"; - } + /// + /// Guid for the Multiple Textstring datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string MultipleTextstring = "5359AD0B-06CC-4182-92BD-0A9117448D3F"; + + /// + /// Alias for the Multiple Textstring datatype. + /// + public const string MultipleTextstringAlias = "Umbraco.MultipleTextstring"; + + /// + /// Guid for the No edit datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string NoEdit = "6C738306-4C17-4D88-B9BD-6546F3771597"; + + /// + /// Alias for the No edit datatype. + /// + public const string NoEditAlias = "Umbraco.NoEdit"; + + /// + /// Guid for the Picker Relations datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string PickerRelations = "83396FF2-2E39-4A90-9066-17F5F3989374"; + + /// + /// Alias for the Picker Relations datatype. + /// + public const string PickerRelationsAlias = "Umbraco.PickerRelations"; + + /// + /// Guid for the Radiobutton list datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string RadioButtonList = "A52C7C1C-C330-476E-8605-D63D3B84B6A6"; + + /// + /// Alias for the Radiobutton list datatype. + /// + public const string RadioButtonListAlias = "Umbraco.RadioButtonList"; + + /// + /// Guid for the Related Links datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string RelatedLinks = "71B8AD1A-8DC2-425C-B6B8-FAA158075E63"; + + /// + /// Alias for the Related Links datatype. + /// + public const string RelatedLinksAlias = "Umbraco.RelatedLinks"; + + /// + /// Guid for the Slider datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string Slider = "29E790E6-26B3-438A-B21F-908663A0B19E"; + + /// + /// Alias for the Slider datatype. + /// + public const string SliderAlias = "Umbraco.Slider"; + + /// + /// Guid for the Tags datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string Tags = "4023E540-92F5-11DD-AD8B-0800200C9A66"; + + /// + /// Alias for the Tags datatype. + /// + public const string TagsAlias = "Umbraco.Tags"; + + /// + /// Guid for the Textbox datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string Textbox = "EC15C1E5-9D90-422A-AA52-4F7622C63BEA"; + + /// + /// Alias for the Textbox datatype. + /// + public const string TextboxAlias = "Umbraco.Textbox"; + + /// + /// Guid for the Textbox multiple datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string TextboxMultiple = "67DB8357-EF57-493E-91AC-936D305E0F2A"; + + /// + /// Alias for the Textbox multiple datatype. + /// + public const string TextboxMultipleAlias = "Umbraco.TextboxMultiple"; + + /// + /// Guid for the TinyMCE v3 wysiwyg datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string TinyMCEv3 = "5E9B75AE-FACE-41C8-B47E-5F4B0FD82F83"; + + /// + /// Alias for the TinyMCE v3 wysiwyg datatype. + /// + public const string TinyMCEv3Alias = "Umbraco.TinyMCEv3"; + + /// + /// Guid for the True/False (Ja/Nej) datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string TrueFalse = "38B352C1-E9F8-4FD8-9324-9A2EAB06D97A"; + + /// + /// Alias for the True/False (Ja/Nej) datatype. + /// + public const string TrueFalseAlias = "Umbraco.TrueFalse"; + + /// + /// Guid for the Ultimate Picker datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string UltimatePicker = "CDBF0B5D-5CB2-445F-BC12-FCAAEC07CF2C"; + + /// + /// Alias for the Ultimate Picker datatype. + /// + public const string UltimatePickerAlias = "Umbraco.UltimatePicker"; + + /// + /// Guid for the UltraSimpleEditor datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string UltraSimpleEditor = "60B7DABF-99CD-41EB-B8E9-4D2E669BBDE9"; + + /// + /// Alias for the UltraSimpleEditor datatype. + /// + public const string UltraSimpleEditorAlias = "Umbraco.UltraSimpleEditor"; + + /// + /// Guid for the Umbraco Usercontrol Wrapper datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string UmbracoUserControlWrapper = "D15E1281-E456-4B24-AA86-1DDA3E4299D5"; + + /// + /// Alias for the Umbraco Usercontrol Wrapper datatype. + /// + public const string UmbracoUserControlWrapperAlias = "Umbraco.UmbracoUserControlWrapper"; + + /// + /// Guid for the Upload field datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string UploadField = "5032A6E6-69E3-491D-BB28-CD31CD11086C"; + + /// + /// Alias for the Upload field datatype. + /// + public const string UploadFieldAlias = "Umbraco.UploadField"; + + /// + /// Guid for the XPath CheckBoxList datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string XPathCheckBoxList = "34451D92-D270-49BA-8C7F-EE55BFEEE1CB"; + + /// + /// Alias for the XPath CheckBoxList datatype. + /// + public const string XPathCheckBoxListAlias = "Umbraco.XPathCheckBoxList"; + + /// + /// Guid for the XPath DropDownList datatype. + /// + [Obsolete("GUIDs are no longer used to reference Property Editors, use the Alias constant instead. This will be removed in future versions")] + public const string XPathDropDownList = "173A96AE-00ED-4A7C-9F76-4B53D4A0A1B9"; + + /// + /// Alias for the XPath DropDownList datatype. + /// + public const string XPathDropDownListAlias = "Umbraco.XPathDropDownList"; + } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Models/ContentExtensions.cs b/src/Umbraco.Core/Models/ContentExtensions.cs index ba0511cda4..66045ecd3d 100644 --- a/src/Umbraco.Core/Models/ContentExtensions.cs +++ b/src/Umbraco.Core/Models/ContentExtensions.cs @@ -438,8 +438,7 @@ namespace Umbraco.Core.Models Resize(fs, fileName, extension, 100, "thumb", originalImage); //Look up Prevalues for this upload datatype - if it is an upload datatype - var uploadFieldId = new Guid(Constants.PropertyEditors.UploadField); - if (property.PropertyType.DataTypeId == uploadFieldId) + if (property.PropertyType.PropertyEditorAlias == Constants.PropertyEditors.UploadFieldAlias) { //Get Prevalues by the DataType's Id: property.PropertyType.DataTypeId var values = ApplicationContext.Current.Services.DataTypeService.GetPreValuesByDataTypeId(property.PropertyType.DataTypeDefinitionId); diff --git a/src/Umbraco.Core/Models/DataTypeDefinition.cs b/src/Umbraco.Core/Models/DataTypeDefinition.cs index f879510c00..249fb609b3 100644 --- a/src/Umbraco.Core/Models/DataTypeDefinition.cs +++ b/src/Umbraco.Core/Models/DataTypeDefinition.cs @@ -2,7 +2,7 @@ using System.Reflection; using System.Runtime.Serialization; using Umbraco.Core.Models.EntityBase; -using Umbraco.Core.Persistence.Mappers; +using Umbraco.Core.Persistence; namespace Umbraco.Core.Models { @@ -24,13 +24,20 @@ namespace Umbraco.Core.Models private string _path; private int _creatorId; private bool _trashed; - private Guid _controlId; + private string _propertyEditorAlias; private DataTypeDatabaseType _databaseType; + [Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the alternative contructor that specifies an alias")] public DataTypeDefinition(int parentId, Guid controlId) { _parentId = parentId; - _controlId = controlId; + _propertyEditorAlias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(controlId, true); + } + + public DataTypeDefinition(int parentId, string propertyEditorAlias) + { + _parentId = parentId; + _propertyEditorAlias = propertyEditorAlias; } private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo(x => x.Name); @@ -40,7 +47,7 @@ namespace Umbraco.Core.Models private static readonly PropertyInfo PathSelector = ExpressionHelper.GetPropertyInfo(x => x.Path); private static readonly PropertyInfo UserIdSelector = ExpressionHelper.GetPropertyInfo(x => x.CreatorId); private static readonly PropertyInfo TrashedSelector = ExpressionHelper.GetPropertyInfo(x => x.Trashed); - private static readonly PropertyInfo ControlIdSelector = ExpressionHelper.GetPropertyInfo(x => x.ControlId); + private static readonly PropertyInfo PropertyEditorAliasSelector = ExpressionHelper.GetPropertyInfo(x => x.PropertyEditorAlias); private static readonly PropertyInfo DatabaseTypeSelector = ExpressionHelper.GetPropertyInfo(x => x.DatabaseType); /// @@ -165,20 +172,32 @@ namespace Umbraco.Core.Models } } + [DataMember] + public string PropertyEditorAlias + { + get { return _propertyEditorAlias; } + set + { + SetPropertyValueAndDetectChanges(o => + { + _propertyEditorAlias = value; + return _propertyEditorAlias; + }, _propertyEditorAlias, PropertyEditorAliasSelector); + } + } + /// /// Id of the DataType control /// [DataMember] + [Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the PropertyEditorAlias property instead")] public Guid ControlId { - get { return _controlId; } - set + get { return LegacyPropertyEditorIdToAliasConverter.GetLegacyIdFromAlias(_propertyEditorAlias, true).Value; } + set { - SetPropertyValueAndDetectChanges(o => - { - _controlId = value; - return _controlId; - }, _controlId, ControlIdSelector); + var alias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(value, true); + PropertyEditorAlias = alias; } } diff --git a/src/Umbraco.Core/Models/IDataTypeDefinition.cs b/src/Umbraco.Core/Models/IDataTypeDefinition.cs index c036ba2251..a33736e604 100644 --- a/src/Umbraco.Core/Models/IDataTypeDefinition.cs +++ b/src/Umbraco.Core/Models/IDataTypeDefinition.cs @@ -5,9 +5,15 @@ namespace Umbraco.Core.Models { public interface IDataTypeDefinition : IUmbracoEntity { + /// + /// The Property editor alias assigned to the data type + /// + string PropertyEditorAlias { get; set; } + /// /// Id of the DataType control /// + [Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the PropertyEditorAlias property instead")] Guid ControlId { get; set; } /// diff --git a/src/Umbraco.Core/Models/PropertyType.cs b/src/Umbraco.Core/Models/PropertyType.cs index 3b4915862a..f5cdf4e2e1 100644 --- a/src/Umbraco.Core/Models/PropertyType.cs +++ b/src/Umbraco.Core/Models/PropertyType.cs @@ -3,7 +3,7 @@ using System.Reflection; using System.Runtime.Serialization; using System.Text.RegularExpressions; using Umbraco.Core.Models.EntityBase; -using Umbraco.Core.Persistence.Mappers; +using Umbraco.Core.Persistence; namespace Umbraco.Core.Models { @@ -19,7 +19,7 @@ namespace Umbraco.Core.Models private string _description; private int _dataTypeDefinitionId; private Lazy _propertyGroupId; - private Guid _dataTypeId; + private string _propertyEditorAlias; private DataTypeDatabaseType _dataTypeDatabaseType; private bool _mandatory; private string _helpText; @@ -31,13 +31,13 @@ namespace Umbraco.Core.Models if(dataTypeDefinition.HasIdentity) DataTypeDefinitionId = dataTypeDefinition.Id; - DataTypeId = dataTypeDefinition.ControlId; + PropertyEditorAlias = dataTypeDefinition.PropertyEditorAlias; DataTypeDatabaseType = dataTypeDefinition.DatabaseType; } - - internal PropertyType(Guid dataTypeControlId, DataTypeDatabaseType dataTypeDatabaseType) + + internal PropertyType(string propertyEditorAlias, DataTypeDatabaseType dataTypeDatabaseType) { - DataTypeId = dataTypeControlId; + PropertyEditorAlias = propertyEditorAlias; DataTypeDatabaseType = dataTypeDatabaseType; } @@ -45,7 +45,7 @@ namespace Umbraco.Core.Models private static readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo(x => x.Alias); private static readonly PropertyInfo DescriptionSelector = ExpressionHelper.GetPropertyInfo(x => x.Description); private static readonly PropertyInfo DataTypeDefinitionIdSelector = ExpressionHelper.GetPropertyInfo(x => x.DataTypeDefinitionId); - private static readonly PropertyInfo DataTypeControlIdSelector = ExpressionHelper.GetPropertyInfo(x => x.DataTypeId); + private static readonly PropertyInfo PropertyEditorAliasSelector = ExpressionHelper.GetPropertyInfo(x => x.PropertyEditorAlias); private static readonly PropertyInfo DataTypeDatabaseTypeSelector = ExpressionHelper.GetPropertyInfo(x => x.DataTypeDatabaseType); private static readonly PropertyInfo MandatorySelector = ExpressionHelper.GetPropertyInfo(x => x.Mandatory); private static readonly PropertyInfo HelpTextSelector = ExpressionHelper.GetPropertyInfo(x => x.HelpText); @@ -122,21 +122,33 @@ namespace Umbraco.Core.Models } } + [DataMember] + public string PropertyEditorAlias + { + get { return _propertyEditorAlias; } + set + { + SetPropertyValueAndDetectChanges(o => + { + _propertyEditorAlias = value; + return _propertyEditorAlias; + }, _propertyEditorAlias, PropertyEditorAliasSelector); + } + } + /// /// Gets of Sets the Id of the DataType control /// /// This is the Id of the actual DataType control [DataMember] + [Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the PropertyEditorAlias property instead")] public Guid DataTypeId { - get { return _dataTypeId; } - internal set + get { return LegacyPropertyEditorIdToAliasConverter.GetLegacyIdFromAlias(_propertyEditorAlias, true).Value; } + set { - SetPropertyValueAndDetectChanges(o => - { - _dataTypeId = value; - return _dataTypeId; - }, _dataTypeId, DataTypeControlIdSelector); + var alias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(value, true); + PropertyEditorAlias = alias; } } @@ -319,7 +331,7 @@ namespace Umbraco.Core.Models return argument == type; }*/ - if (DataTypeId != Guid.Empty) + if (PropertyEditorAlias.IsNullOrWhiteSpace() == false) { //Find DataType by Id //IDataType dataType = DataTypesResolver.Current.GetById(DataTypeControlId); @@ -380,7 +392,7 @@ namespace Umbraco.Core.Models internal PropertyType Clone() { - var clone = (PropertyType) this.MemberwiseClone(); + var clone = (PropertyType) MemberwiseClone(); clone.ResetIdentity(); clone.ResetDirtyProperties(false); return clone; @@ -389,10 +401,10 @@ namespace Umbraco.Core.Models public bool Equals(PropertyType other) { //Check whether the compared object is null. - if (Object.ReferenceEquals(other, null)) return false; + if (ReferenceEquals(other, null)) return false; //Check whether the compared object references the same data. - if (Object.ReferenceEquals(this, other)) return true; + if (ReferenceEquals(this, other)) return true; //Check whether the PropertyType's properties are equal. return Alias.Equals(other.Alias) && Name.Equals(other.Name); diff --git a/src/Umbraco.Core/Models/Rdbms/DataTypeDto.cs b/src/Umbraco.Core/Models/Rdbms/DataTypeDto.cs index 66d2f059f2..9cbf523386 100644 --- a/src/Umbraco.Core/Models/Rdbms/DataTypeDto.cs +++ b/src/Umbraco.Core/Models/Rdbms/DataTypeDto.cs @@ -18,8 +18,8 @@ namespace Umbraco.Core.Models.Rdbms [Index(IndexTypes.UniqueNonClustered)] public int DataTypeId { get; set; } - [Column("controlId")] - public Guid ControlId { get; set; } + [Column("propertyEditorAlias")] + public string PropertyEditorAlias { get; set; } [Column("dbType")] [Length(50)] diff --git a/src/Umbraco.Core/Models/Rdbms/PropertyDataReadOnlyDto.cs b/src/Umbraco.Core/Models/Rdbms/PropertyDataReadOnlyDto.cs index 31f65e14aa..8de3d8a9e7 100644 --- a/src/Umbraco.Core/Models/Rdbms/PropertyDataReadOnlyDto.cs +++ b/src/Umbraco.Core/Models/Rdbms/PropertyDataReadOnlyDto.cs @@ -59,7 +59,7 @@ namespace Umbraco.Core.Models.Rdbms public string Description { get; set; } /* cmsDataType */ - [Column("controlId")] - public Guid ControlId { get; set; } + [Column("propertyEditorAlias")] + public string PropertyEditorAlias { get; set; } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Models/UmbracoEntity.cs b/src/Umbraco.Core/Models/UmbracoEntity.cs index 451c0fe9c1..030d97272f 100644 --- a/src/Umbraco.Core/Models/UmbracoEntity.cs +++ b/src/Umbraco.Core/Models/UmbracoEntity.cs @@ -250,7 +250,7 @@ namespace Umbraco.Core.Models internal class UmbracoProperty { - public Guid DataTypeControlId { get; set; } + public string PropertyEditorAlias { get; set; } public string Value { get; set; } } } diff --git a/src/Umbraco.Core/Persistence/Factories/DataTypeDefinitionFactory.cs b/src/Umbraco.Core/Persistence/Factories/DataTypeDefinitionFactory.cs index b046979245..13a7ecad35 100644 --- a/src/Umbraco.Core/Persistence/Factories/DataTypeDefinitionFactory.cs +++ b/src/Umbraco.Core/Persistence/Factories/DataTypeDefinitionFactory.cs @@ -19,7 +19,7 @@ namespace Umbraco.Core.Persistence.Factories public IDataTypeDefinition BuildEntity(DataTypeDto dto) { - var dataTypeDefinition = new DataTypeDefinition(dto.NodeDto.ParentId, dto.ControlId) + var dataTypeDefinition = new DataTypeDefinition(dto.NodeDto.ParentId, dto.PropertyEditorAlias) { CreateDate = dto.NodeDto.CreateDate, DatabaseType = dto.DbType.EnumParse(true), @@ -47,7 +47,7 @@ namespace Umbraco.Core.Persistence.Factories { var dataTypeDto = new DataTypeDto { - ControlId = entity.ControlId, + PropertyEditorAlias = entity.PropertyEditorAlias, DataTypeId = entity.Id, DbType = entity.DatabaseType.ToString(), NodeDto = BuildNodeDto(entity) diff --git a/src/Umbraco.Core/Persistence/Factories/PropertyGroupFactory.cs b/src/Umbraco.Core/Persistence/Factories/PropertyGroupFactory.cs index 57cc79bc32..adbb3ad7f5 100644 --- a/src/Umbraco.Core/Persistence/Factories/PropertyGroupFactory.cs +++ b/src/Umbraco.Core/Persistence/Factories/PropertyGroupFactory.cs @@ -55,7 +55,7 @@ namespace Umbraco.Core.Persistence.Factories foreach (var typeDto in typeDtos) { var tempGroupDto = groupDto; - var propertyType = new PropertyType(typeDto.DataTypeDto.ControlId, + var propertyType = new PropertyType(typeDto.DataTypeDto.PropertyEditorAlias, typeDto.DataTypeDto.DbType.EnumParse(true)) { Alias = typeDto.Alias, diff --git a/src/Umbraco.Core/Persistence/Factories/UmbracoEntityFactory.cs b/src/Umbraco.Core/Persistence/Factories/UmbracoEntityFactory.cs index d7b8247364..182b61f80a 100644 --- a/src/Umbraco.Core/Persistence/Factories/UmbracoEntityFactory.cs +++ b/src/Umbraco.Core/Persistence/Factories/UmbracoEntityFactory.cs @@ -39,8 +39,8 @@ namespace Umbraco.Core.Persistence.Factories { entity.UmbracoProperties.Add(new UmbracoEntity.UmbracoProperty { - DataTypeControlId = - propertyDto.DataTypeControlId, + PropertyEditorAlias = + propertyDto.PropertyEditorAlias, Value = propertyDto.UmbracoFile }); } diff --git a/src/Umbraco.Core/Persistence/LegacyPropertyEditorIdToAliasConverter.cs b/src/Umbraco.Core/Persistence/LegacyPropertyEditorIdToAliasConverter.cs new file mode 100644 index 0000000000..bc0784eac4 --- /dev/null +++ b/src/Umbraco.Core/Persistence/LegacyPropertyEditorIdToAliasConverter.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Umbraco.Core.Persistence +{ + + /// + /// This is used to map old legacy property editor GUID's to the new Property Editor alias (string) format. + /// + /// + /// This can be used by developers on application startup to register a mapping from their old ids to their new aliases and vice-versa. + /// + public static class LegacyPropertyEditorIdToAliasConverter + { + /// + /// The map consists of a key which is always the GUID (lowercase, no hyphens + alias (trimmed)) + /// + private static readonly ConcurrentDictionary> Map = new ConcurrentDictionary>(); + + /// + /// Creates a map for the specified legacy id and property editor alias + /// + /// + /// + /// true if the map was created or false if it was already created + public static bool CreateMap(Guid legacyId, string alias) + { + var key = legacyId.ToString("N").ToLowerInvariant() + alias.Trim(); + return Map.TryAdd(key, new Tuple(legacyId, alias)); + } + + /// + /// Gets an alias based on the legacy ID + /// + /// + /// if set to true will throw an exception if the map isn't found + /// Returns the alias if found otherwise null if not found + public static string GetAliasFromLegacyId(Guid legacyId, bool throwIfNotFound = false) + { + var found = Map.SingleOrDefault(x => x.Value.Item1 == legacyId); + if (found.Equals(default(KeyValuePair>))) + { + if (throwIfNotFound) + { + throw new ObjectNotFoundException("Could not find a map for a property editor with a legacy id of " + legacyId); + } + return null; + } + return found.Value.Item2; + } + + /// + /// Gets a legacy Id based on the alias + /// + /// + /// if set to true will throw an exception if the map isn't found + /// Returns the legacy GUID of a property editor if found, otherwise returns null + public static Guid? GetLegacyIdFromAlias(string alias, bool throwIfNotFound = false) + { + var found = Map.SingleOrDefault(x => x.Value.Item2 == alias); + if (found.Equals(default(KeyValuePair>))) + { + if (throwIfNotFound) + { + throw new ObjectNotFoundException("Could not find a map for a property editor with an alias of " + alias); + } + return null; + } + return found.Value.Item1; + } + + + } +} diff --git a/src/Umbraco.Core/Persistence/Mappers/DataTypeDefinitionMapper.cs b/src/Umbraco.Core/Persistence/Mappers/DataTypeDefinitionMapper.cs index bc847431f8..ea27c8699f 100644 --- a/src/Umbraco.Core/Persistence/Mappers/DataTypeDefinitionMapper.cs +++ b/src/Umbraco.Core/Persistence/Mappers/DataTypeDefinitionMapper.cs @@ -42,7 +42,7 @@ namespace Umbraco.Core.Persistence.Mappers CacheMap(src => src.Trashed, dto => dto.Trashed); CacheMap(src => src.Key, dto => dto.UniqueId); CacheMap(src => src.CreatorId, dto => dto.UserId); - CacheMap(src => src.ControlId, dto => dto.ControlId); + CacheMap(src => src.PropertyEditorAlias, dto => dto.PropertyEditorAlias); CacheMap(src => src.DatabaseType, dto => dto.DbType); } diff --git a/src/Umbraco.Core/Persistence/Mappers/PropertyTypeMapper.cs b/src/Umbraco.Core/Persistence/Mappers/PropertyTypeMapper.cs index 6cc4fc901b..339994a322 100644 --- a/src/Umbraco.Core/Persistence/Mappers/PropertyTypeMapper.cs +++ b/src/Umbraco.Core/Persistence/Mappers/PropertyTypeMapper.cs @@ -42,7 +42,7 @@ namespace Umbraco.Core.Persistence.Mappers CacheMap(src => src.Name, dto => dto.Name); CacheMap(src => src.SortOrder, dto => dto.SortOrder); CacheMap(src => src.ValidationRegExp, dto => dto.ValidationRegExp); - CacheMap(src => src.DataTypeId, dto => dto.ControlId); + CacheMap(src => src.PropertyEditorAlias, dto => dto.PropertyEditorAlias); CacheMap(src => src.DataTypeDatabaseType, dto => dto.DbType); } } diff --git a/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs b/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs index 35d26f513b..3cd8931742 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs @@ -219,30 +219,30 @@ namespace Umbraco.Core.Persistence.Migrations.Initial private void CreateCmsDataTypeData() { //TODO Check which of the DataTypeIds below doesn't exist in umbracoNode, which results in a foreign key constraint errors. - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 1, DataTypeId = -49, ControlId = new Guid(Constants.PropertyEditors.TrueFalse), DbType = "Integer" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 2, DataTypeId = -51, ControlId = new Guid(Constants.PropertyEditors.Integer), DbType = "Integer" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 3, DataTypeId = -87, ControlId = new Guid(Constants.PropertyEditors.TinyMCEv3), DbType = "Ntext" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 4, DataTypeId = -88, ControlId = new Guid(Constants.PropertyEditors.Textbox), DbType = "Nvarchar" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 5, DataTypeId = -89, ControlId = new Guid(Constants.PropertyEditors.TextboxMultiple), DbType = "Ntext" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 6, DataTypeId = -90, ControlId = new Guid(Constants.PropertyEditors.UploadField), DbType = "Nvarchar" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 7, DataTypeId = -92, ControlId = new Guid(Constants.PropertyEditors.NoEdit), DbType = "Nvarchar" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 8, DataTypeId = -36, ControlId = new Guid(Constants.PropertyEditors.DateTime), DbType = "Date" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 9, DataTypeId = -37, ControlId = new Guid(Constants.PropertyEditors.ColorPicker), DbType = "Nvarchar" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 10, DataTypeId = -38, ControlId = new Guid(Constants.PropertyEditors.FolderBrowser), DbType = "Nvarchar" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 11, DataTypeId = -39, ControlId = new Guid(Constants.PropertyEditors.DropDownListMultiple), DbType = "Nvarchar" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 12, DataTypeId = -40, ControlId = new Guid(Constants.PropertyEditors.RadioButtonList), DbType = "Nvarchar" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 13, DataTypeId = -41, ControlId = new Guid(Constants.PropertyEditors.Date), DbType = "Date" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 14, DataTypeId = -42, ControlId = new Guid(Constants.PropertyEditors.DropDownList), DbType = "Integer" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 15, DataTypeId = -43, ControlId = new Guid(Constants.PropertyEditors.CheckBoxList), DbType = "Nvarchar" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 16, DataTypeId = 1034, ControlId = new Guid(Constants.PropertyEditors.ContentPicker), DbType = "Integer" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 17, DataTypeId = 1035, ControlId = new Guid(Constants.PropertyEditors.MediaPicker), DbType = "Integer" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 18, DataTypeId = 1036, ControlId = new Guid(Constants.PropertyEditors.MemberPicker), DbType = "Integer" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 19, DataTypeId = 1038, ControlId = new Guid(Constants.PropertyEditors.UltraSimpleEditor), DbType = "Ntext" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 20, DataTypeId = 1039, ControlId = new Guid(Constants.PropertyEditors.UltimatePicker), DbType = "Ntext" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 21, DataTypeId = 1040, ControlId = new Guid(Constants.PropertyEditors.RelatedLinks), DbType = "Ntext" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 22, DataTypeId = 1041, ControlId = new Guid(Constants.PropertyEditors.Tags), DbType = "Ntext" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 23, DataTypeId = 1042, ControlId = new Guid(Constants.PropertyEditors.MacroContainer), DbType = "Ntext" }); - _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 24, DataTypeId = 1043, ControlId = new Guid(Constants.PropertyEditors.ImageCropper), DbType = "Ntext" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 1, DataTypeId = -49, PropertyEditorAlias = Constants.PropertyEditors.TrueFalseAlias, DbType = "Integer" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 2, DataTypeId = -51, PropertyEditorAlias = Constants.PropertyEditors.IntegerAlias, DbType = "Integer" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 3, DataTypeId = -87, PropertyEditorAlias = Constants.PropertyEditors.TinyMCEv3Alias, DbType = "Ntext" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 4, DataTypeId = -88, PropertyEditorAlias = Constants.PropertyEditors.TextboxAlias, DbType = "Nvarchar" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 5, DataTypeId = -89, PropertyEditorAlias = Constants.PropertyEditors.TextboxMultipleAlias, DbType = "Ntext" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 6, DataTypeId = -90, PropertyEditorAlias = Constants.PropertyEditors.UploadFieldAlias, DbType = "Nvarchar" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 7, DataTypeId = -92, PropertyEditorAlias = Constants.PropertyEditors.NoEditAlias, DbType = "Nvarchar" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 8, DataTypeId = -36, PropertyEditorAlias = Constants.PropertyEditors.DateTimeAlias, DbType = "Date" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 9, DataTypeId = -37, PropertyEditorAlias = Constants.PropertyEditors.ColorPickerAlias, DbType = "Nvarchar" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 10, DataTypeId = -38, PropertyEditorAlias = Constants.PropertyEditors.FolderBrowserAlias, DbType = "Nvarchar" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 11, DataTypeId = -39, PropertyEditorAlias = Constants.PropertyEditors.DropDownListMultipleAlias, DbType = "Nvarchar" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 12, DataTypeId = -40, PropertyEditorAlias = Constants.PropertyEditors.RadioButtonListAlias, DbType = "Nvarchar" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 13, DataTypeId = -41, PropertyEditorAlias = Constants.PropertyEditors.DateAlias, DbType = "Date" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 14, DataTypeId = -42, PropertyEditorAlias = Constants.PropertyEditors.DropDownListAlias, DbType = "Integer" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 15, DataTypeId = -43, PropertyEditorAlias = Constants.PropertyEditors.CheckBoxListAlias, DbType = "Nvarchar" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 16, DataTypeId = 1034, PropertyEditorAlias = Constants.PropertyEditors.ContentPickerAlias, DbType = "Integer" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 17, DataTypeId = 1035, PropertyEditorAlias = Constants.PropertyEditors.MediaPickerAlias, DbType = "Integer" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 18, DataTypeId = 1036, PropertyEditorAlias = Constants.PropertyEditors.MemberPickerAlias, DbType = "Integer" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 19, DataTypeId = 1038, PropertyEditorAlias = Constants.PropertyEditors.UltraSimpleEditorAlias, DbType = "Ntext" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 20, DataTypeId = 1039, PropertyEditorAlias = Constants.PropertyEditors.UltimatePickerAlias, DbType = "Ntext" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 21, DataTypeId = 1040, PropertyEditorAlias = Constants.PropertyEditors.RelatedLinksAlias, DbType = "Ntext" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 22, DataTypeId = 1041, PropertyEditorAlias = Constants.PropertyEditors.TagsAlias, DbType = "Ntext" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 23, DataTypeId = 1042, PropertyEditorAlias = Constants.PropertyEditors.MacroContainerAlias, DbType = "Ntext" }); + _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 24, DataTypeId = 1043, PropertyEditorAlias = Constants.PropertyEditors.ImageCropperAlias, DbType = "Ntext" }); } private void CreateCmsDataTypePreValuesData() diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/ChangeControlIdColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/ChangeControlIdColumn.cs new file mode 100644 index 0000000000..23ea539fd2 --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/ChangeControlIdColumn.cs @@ -0,0 +1,20 @@ +using System; +using Umbraco.Core.Configuration; + +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven +{ + [Migration("7.0.0", 0, GlobalSettings.UmbracoMigrationName)] + public class ChangeControlIdColumn : MigrationBase + { + public override void Up() + { + Rename.Column("controlId").OnTable("cmsDataType").To("propertyEditorAlias"); + Alter.Column("controlId").OnTable("cmsDataType").AsString(255); + } + + public override void Down() + { + throw new NotSupportedException("Cannot downgrade from a version 7 database to a prior version"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs b/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs index 6e07cfecd7..d105a6c369 100644 --- a/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs @@ -429,11 +429,11 @@ namespace Umbraco.Core.Persistence.Repositories protected override void PersistDeletedItem(IContent entity) { var fs = FileSystemProviderManager.Current.GetFileSystemProvider(); - var uploadFieldId = new Guid(Constants.PropertyEditors.UploadField); + //Loop through properties to check if the content contains images/files that should be deleted foreach (var property in entity.Properties) { - if (property.PropertyType.DataTypeId == uploadFieldId && property.Value != null && + if (property.PropertyType.PropertyEditorAlias == Constants.PropertyEditors.UploadFieldAlias && property.Value != null && string.IsNullOrEmpty(property.Value.ToString()) == false && fs.FileExists(IOHelper.MapPath(property.Value.ToString()))) { diff --git a/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs b/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs index 995be6e7b2..bcbba28e8a 100644 --- a/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs @@ -161,7 +161,7 @@ namespace Umbraco.Core.Persistence.Repositories //Update the current PropertyType with correct ControlId and DatabaseType var dataTypeDto = Database.FirstOrDefault("WHERE nodeId = @Id", new { Id = propertyTypeDto.DataTypeId }); - propertyType.DataTypeId = dataTypeDto.ControlId; + propertyType.PropertyEditorAlias = dataTypeDto.PropertyEditorAlias; propertyType.DataTypeDatabaseType = dataTypeDto.DbType.EnumParse(true); } } @@ -362,7 +362,7 @@ namespace Umbraco.Core.Persistence.Repositories var list = (from dto in dtos where (dto.PropertyTypeGroupId > 0) == false select - new PropertyType(dto.DataTypeDto.ControlId, + new PropertyType(dto.DataTypeDto.PropertyEditorAlias, dto.DataTypeDto.DbType.EnumParse(true)) { Alias = dto.Alias, diff --git a/src/Umbraco.Core/Persistence/Repositories/EntityRepository.cs b/src/Umbraco.Core/Persistence/Repositories/EntityRepository.cs index 8651068030..50e0063937 100644 --- a/src/Umbraco.Core/Persistence/Repositories/EntityRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/EntityRepository.cs @@ -169,7 +169,7 @@ namespace Umbraco.Core.Persistence.Repositories if (isMedia) { columns.Add("property.dataNvarchar as umbracoFile"); - columns.Add("property.controlId"); + columns.Add("property.propertyEditorAlias"); } var sql = new Sql() @@ -193,7 +193,7 @@ namespace Umbraco.Core.Persistence.Repositories if (isMedia) { sql.LeftJoin( - "(SELECT contentNodeId, versionId, dataNvarchar, controlId FROM cmsPropertyData " + + "(SELECT contentNodeId, versionId, dataNvarchar, propertyEditorAlias FROM cmsPropertyData " + "INNER JOIN umbracoNode ON cmsPropertyData.contentNodeId = umbracoNode.id " + "INNER JOIN cmsPropertyType ON cmsPropertyType.id = cmsPropertyData.propertytypeid " + "INNER JOIN cmsDataType ON cmsPropertyType.dataTypeId = cmsDataType.nodeId "+ @@ -256,7 +256,7 @@ namespace Umbraco.Core.Persistence.Repositories if (isMedia) { columns.Add("property.dataNvarchar"); - columns.Add("property.controlId"); + columns.Add("property.propertyEditorAlias"); } var sql = new Sql() @@ -309,8 +309,8 @@ namespace Umbraco.Core.Persistence.Repositories [ExplicitColumns] internal class UmbracoPropertyDto { - [Column("controlId")] - public Guid DataTypeControlId { get; set; } + [Column("propertyEditorAlias")] + public string PropertyEditorAlias { get; set; } [Column("umbracoFile")] public string UmbracoFile { get; set; } diff --git a/src/Umbraco.Core/Persistence/Repositories/MediaRepository.cs b/src/Umbraco.Core/Persistence/Repositories/MediaRepository.cs index a2035023b4..65c7067187 100644 --- a/src/Umbraco.Core/Persistence/Repositories/MediaRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/MediaRepository.cs @@ -327,11 +327,11 @@ namespace Umbraco.Core.Persistence.Repositories protected override void PersistDeletedItem(IMedia entity) { var fs = FileSystemProviderManager.Current.GetFileSystemProvider(); - var uploadFieldId = new Guid(Constants.PropertyEditors.UploadField); + //Loop through properties to check if the media item contains images/file that should be deleted foreach (var property in entity.Properties) { - if (property.PropertyType.DataTypeId == uploadFieldId && + if (property.PropertyType.PropertyEditorAlias == Constants.PropertyEditors.UploadFieldAlias && string.IsNullOrEmpty(property.Value.ToString()) == false && fs.FileExists(IOHelper.MapPath(property.Value.ToString()))) { diff --git a/src/Umbraco.Core/Persistence/Repositories/MemberRepository.cs b/src/Umbraco.Core/Persistence/Repositories/MemberRepository.cs index fe322e8c31..327c310a9c 100644 --- a/src/Umbraco.Core/Persistence/Repositories/MemberRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/MemberRepository.cs @@ -72,7 +72,7 @@ namespace Umbraco.Core.Persistence.Repositories "cmsPropertyData.propertytypeid", "cmsPropertyType.Alias", "cmsPropertyType.Description", "cmsPropertyType.Name", "cmsPropertyType.mandatory", "cmsPropertyType.validationRegExp", "cmsPropertyType.helpText", "cmsPropertyType.propertyTypeGroupId", "cmsPropertyType.dataTypeId", - "cmsDataType.controlId") + "cmsDataType.propertyEditorAlias") .From() .InnerJoin().On(left => left.NodeId, right => right.NodeId) .InnerJoin().On(left => left.NodeId, right => right.ContentTypeId) diff --git a/src/Umbraco.Core/Persistence/Repositories/RecycleBinRepository.cs b/src/Umbraco.Core/Persistence/Repositories/RecycleBinRepository.cs index 42d90aa81c..a13ff89306 100644 --- a/src/Umbraco.Core/Persistence/Repositories/RecycleBinRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/RecycleBinRepository.cs @@ -35,15 +35,15 @@ namespace Umbraco.Core.Persistence.Repositories //Issue query to get all trashed content or media that has the Upload field as a property //The value for each field is stored in a list: FilesToDelete() - //Alias: Constants.Conventions.Media.File and ControlId: Constants.PropertyEditors.UploadField + //Alias: Constants.Conventions.Media.File and PropertyEditorAlias: Constants.PropertyEditors.UploadField var sql = new Sql(); sql.Select("DISTINCT(dataNvarchar)") .From() .InnerJoin().On(left => left.NodeId, right => right.NodeId) .InnerJoin().On(left => left.PropertyTypeId, right => right.Id) .InnerJoin().On(left => left.DataTypeId, right => right.DataTypeId) - .Where("umbracoNode.trashed = '1' AND umbracoNode.nodeObjectType = @NodeObjectType AND dataNvarchar IS NOT NULL AND (cmsPropertyType.Alias = @FileAlias OR cmsDataType.controlId = @ControlId)", - new { FileAlias = Constants.Conventions.Media.File, NodeObjectType = nodeObjectType, ControlId = Constants.PropertyEditors.UploadField }); + .Where("umbracoNode.trashed = '1' AND umbracoNode.nodeObjectType = @NodeObjectType AND dataNvarchar IS NOT NULL AND (cmsPropertyType.Alias = @FileAlias OR cmsDataType.propertyEditorAlias = @PropertyEditorAlias)", + new { FileAlias = Constants.Conventions.Media.File, NodeObjectType = nodeObjectType, PropertyEditorAlias = Constants.PropertyEditors.UploadFieldAlias }); var files = db.Fetch(sql); return files; diff --git a/src/Umbraco.Core/PropertyEditors/IPropertyEditorValueConverter.cs b/src/Umbraco.Core/PropertyEditors/IPropertyEditorValueConverter.cs index 386a350e29..843dbfc5fe 100644 --- a/src/Umbraco.Core/PropertyEditors/IPropertyEditorValueConverter.cs +++ b/src/Umbraco.Core/PropertyEditors/IPropertyEditorValueConverter.cs @@ -3,6 +3,18 @@ using Umbraco.Core.Dynamics; namespace Umbraco.Core.PropertyEditors { + + public abstract class PropertyValueConverter + { + /// + /// Returns the alias of the PropertyEditor that this converter is for + /// + public abstract string AssociatedPropertyEditorAlias { get; } + + public abstract object ConvertSourceToObject(object valueToConvert, bool isPreviewing); + } + + [Obsolete("Use PropertyConverter instead since we no longer reference property editors by a GUID and instead by a string alias")] public interface IPropertyEditorValueConverter { @@ -13,7 +25,7 @@ namespace Umbraco.Core.PropertyEditors /// /// /// - bool IsConverterFor(Guid propertyEditorId, string docTypeAlias, string propertyTypeAlias); + bool IsConverterFor(Guid propertyEditorId, string docTypeAlias, string propertyTypeAlias); /// /// Attempts to convert the value specified into a useable value on the front-end diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index 6d0e002eea..adc06a5e77 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -1088,14 +1088,14 @@ namespace Umbraco.Core.Services //Special case for the Upload DataType //TODO: Should we handle this with events? - var uploadDataTypeId = new Guid(Constants.PropertyEditors.UploadField); - if (content.Properties.Any(x => x.PropertyType.DataTypeId == uploadDataTypeId)) + + if (content.Properties.Any(x => x.PropertyType.PropertyEditorAlias == Constants.PropertyEditors.UploadFieldAlias)) { bool isUpdated = false; var fs = FileSystemProviderManager.Current.GetFileSystemProvider(); //Loop through properties to check if the content contains media that should be deleted - foreach (var property in content.Properties.Where(x => x.PropertyType.DataTypeId == uploadDataTypeId + foreach (var property in content.Properties.Where(x => x.PropertyType.PropertyEditorAlias == Constants.PropertyEditors.UploadFieldAlias && string.IsNullOrEmpty(x.Value.ToString()) == false)) { if (fs.FileExists(IOHelper.MapPath(property.Value.ToString()))) @@ -1125,8 +1125,7 @@ namespace Umbraco.Core.Services } //Special case for the Tags DataType - var tagsDataTypeId = new Guid(Constants.PropertyEditors.Tags); - if (content.Properties.Any(x => x.PropertyType.DataTypeId == tagsDataTypeId)) + if (content.Properties.Any(x => x.PropertyType.PropertyEditorAlias == Constants.PropertyEditors.TagsAlias)) { var tags = uow.Database.Fetch("WHERE nodeId = @Id", new { Id = content.Id }); foreach (var tag in tags) diff --git a/src/Umbraco.Core/Services/DataTypeService.cs b/src/Umbraco.Core/Services/DataTypeService.cs index 17951772dc..188d743994 100644 --- a/src/Umbraco.Core/Services/DataTypeService.cs +++ b/src/Umbraco.Core/Services/DataTypeService.cs @@ -76,11 +76,23 @@ namespace Umbraco.Core.Services /// /// Id of the DataType control /// Collection of objects with a matching contorl id + [Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the overload GetDataTypeDefinitionByPropertyEditorAlias instead")] public IEnumerable GetDataTypeDefinitionByControlId(Guid id) + { + var alias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(id, true); + return GetDataTypeDefinitionByPropertyEditorAlias(alias); + } + + /// + /// Gets a by its control Id + /// + /// Alias of the property editor + /// Collection of objects with a matching contorl id + public IEnumerable GetDataTypeDefinitionByPropertyEditorAlias(string propertyEditorAlias) { using (var repository = _repositoryFactory.CreateDataTypeDefinitionRepository(_uowProvider.GetUnitOfWork())) { - var query = Query.Builder.Where(x => x.ControlId == id); + var query = Query.Builder.Where(x => x.PropertyEditorAlias == propertyEditorAlias); var definitions = repository.GetByQuery(query); return definitions; diff --git a/src/Umbraco.Core/Services/IDataTypeService.cs b/src/Umbraco.Core/Services/IDataTypeService.cs index 37d220573f..6df168d9d3 100644 --- a/src/Umbraco.Core/Services/IDataTypeService.cs +++ b/src/Umbraco.Core/Services/IDataTypeService.cs @@ -61,12 +61,14 @@ namespace Umbraco.Core.Services /// /// Id of the DataType, which corresponds to the Guid Id of the control /// object + [Obsolete("IDataType is obsolete and is no longer used, it will be removed from the codebase in future versions")] IDataType GetDataTypeById(Guid id); - + /// /// Gets a complete list of all registered 's /// /// An enumerable list of objects + [Obsolete("IDataType is obsolete and is no longer used, it will be removed from the codebase in future versions")] IEnumerable GetAllDataTypes(); /// @@ -74,8 +76,16 @@ namespace Umbraco.Core.Services /// /// Id of the DataType control /// + [Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the overload GetDataTypeDefinitionByPropertyEditorAlias instead")] IEnumerable GetDataTypeDefinitionByControlId(Guid id); + /// + /// Gets a by its control Id + /// + /// Alias of the property editor + /// Collection of objects with a matching contorl id + IEnumerable GetDataTypeDefinitionByPropertyEditorAlias(string propertyEditorAlias); + /// /// Gets all values for an /// diff --git a/src/Umbraco.Core/Services/PackagingService.cs b/src/Umbraco.Core/Services/PackagingService.cs index fb7a3252cd..eaa2805e48 100644 --- a/src/Umbraco.Core/Services/PackagingService.cs +++ b/src/Umbraco.Core/Services/PackagingService.cs @@ -308,7 +308,7 @@ namespace Umbraco.Core.Services var propertyValue = property.Value; var propertyType = contentType.PropertyTypes.FirstOrDefault(pt => pt.Alias == propertyTypeAlias); - if (propertyType != null && propertyType.DataTypeId == new Guid(Constants.PropertyEditors.CheckBoxList)) + if (propertyType != null && propertyType.PropertyEditorAlias == Constants.PropertyEditors.CheckBoxListAlias) { var database = ApplicationContext.Current.DatabaseContext.Database; var dtos = database.Fetch("WHERE datatypeNo" + "deId = @Id", new { Id = propertyType.DataTypeDefinitionId }); @@ -591,6 +591,8 @@ namespace Umbraco.Core.Services var properties = genericPropertiesElement.Elements("GenericProperty"); foreach (var property in properties) { + //TODO: Need to update this whole service to support the PropertyEditorAlias change, but somehow still support the old GUID package format. + var dataTypeId = new Guid(property.Element("Type").Value);//The DataType's Control Id var dataTypeDefinitionId = new Guid(property.Element("Definition").Value);//Unique Id for a DataTypeDefinition diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 7b5de2e441..af69e1b3d6 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -349,6 +349,7 @@ + @@ -534,6 +535,7 @@ + diff --git a/src/Umbraco.Tests/Models/ContentTests.cs b/src/Umbraco.Tests/Models/ContentTests.cs index f809c87d5b..321f106a5e 100644 --- a/src/Umbraco.Tests/Models/ContentTests.cs +++ b/src/Umbraco.Tests/Models/ContentTests.cs @@ -57,8 +57,8 @@ namespace Umbraco.Tests.Models { var contentType = MockedContentTypes.CreateSimpleContentType(); //add non-grouped properties - contentType.AddPropertyType(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) {Alias = "nonGrouped1", Name = "Non Grouped 1", Description = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88}); - contentType.AddPropertyType(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "nonGrouped2", Name = "Non Grouped 2", Description = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + contentType.AddPropertyType(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "nonGrouped1", Name = "Non Grouped 1", Description = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + contentType.AddPropertyType(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "nonGrouped2", Name = "Non Grouped 2", Description = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); //ensure that nothing is marked as dirty contentType.ResetDirtyProperties(false); @@ -269,7 +269,7 @@ namespace Umbraco.Tests.Models var content = MockedContent.CreateTextpageContent(contentType, "Textpage", -1); // Act - contentType.PropertyGroups["Content"].PropertyTypes.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) + contentType.PropertyGroups["Content"].PropertyTypes.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "subtitle", Name = "Subtitle", @@ -293,7 +293,7 @@ namespace Umbraco.Tests.Models var content = MockedContent.CreateTextpageContent(contentType, "Textpage", -1); // Act - var propertyType = new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) + var propertyType = new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "subtitle", Name = "Subtitle", Description = "Optional subtitle", HelpText = "", Mandatory = false, SortOrder = 3, DataTypeDefinitionId = -88 }; @@ -313,7 +313,7 @@ namespace Umbraco.Tests.Models var content = MockedContent.CreateTextpageContent(contentType, "Textpage", -1); // Act - var propertyType = new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) + var propertyType = new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "subtitle", Name = "Subtitle", @@ -344,7 +344,7 @@ namespace Umbraco.Tests.Models var content = MockedContent.CreateTextpageContent(contentType, "Textpage", -1); // Act - note that the PropertyType's properties like SortOrder is not updated through the Content object - var propertyType = new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) + var propertyType = new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "Title description added", HelpText = "", Mandatory = false, SortOrder = 10, DataTypeDefinitionId = -88 }; @@ -532,7 +532,7 @@ namespace Umbraco.Tests.Models contentType.ResetDirtyProperties(); // Act - var propertyType = new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) + var propertyType = new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "subtitle", Name = "Subtitle", @@ -559,7 +559,7 @@ namespace Umbraco.Tests.Models new PropertyTypeCollection( new List { - new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) + new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "coauthor", Name = "Co-Author", @@ -592,7 +592,7 @@ namespace Umbraco.Tests.Models new PropertyTypeCollection( new List { - new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) + new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "coauthor", Name = "Co-Author", @@ -627,7 +627,7 @@ namespace Umbraco.Tests.Models var mixin1 = MockedContentTypes.CreateSimpleContentType("mixin1", "Mixin1", new PropertyTypeCollection( new List { - new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) + new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "coauthor", Name = "Co-Author", @@ -641,7 +641,7 @@ namespace Umbraco.Tests.Models var mixin2 = MockedContentTypes.CreateSimpleContentType("mixin2", "Mixin2", new PropertyTypeCollection( new List { - new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) + new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "author", Name = "Author", diff --git a/src/Umbraco.Tests/Models/DataValueSetterTests.cs b/src/Umbraco.Tests/Models/DataValueSetterTests.cs index 328da03985..5382858195 100644 --- a/src/Umbraco.Tests/Models/DataValueSetterTests.cs +++ b/src/Umbraco.Tests/Models/DataValueSetterTests.cs @@ -67,7 +67,7 @@ namespace Umbraco.Tests.Models public void SetValue_Is_Called_When_Executing_ToXml_On_A_Property_With_DataType_That_Implements_IDataValueSetter() { // Arrange - var dataTypeId = Guid.NewGuid(); + var propEdId = Guid.NewGuid(); var dataTypeData = MockRepository.GenerateMock(); @@ -84,12 +84,12 @@ namespace Umbraco.Tests.Models dataType.Stub(type => type.Data).Return(dataTypeData); var dataTypeSvc = MockRepository.GenerateStub(); - dataTypeSvc.Stub(service => service.GetDataTypeById(dataTypeId)).Return(dataType); + dataTypeSvc.Stub(service => service.GetDataTypeById(Arg.Is.Anything)).Return(dataType); var property = new Property( 1234, Guid.NewGuid(), - new PropertyType(dataTypeId, DataTypeDatabaseType.Nvarchar) + new PropertyType("test", DataTypeDatabaseType.Nvarchar) { Alias = "test" }, "Hello world"); diff --git a/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs b/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs index 44d3149e85..0b339a5910 100644 --- a/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs +++ b/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs @@ -123,8 +123,8 @@ namespace Umbraco.Tests.Models.Mapping var idSeed = 1; var contentType = MockedContentTypes.CreateSimpleContentType(); //add non-grouped properties - contentType.AddPropertyType(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "nonGrouped1", Name = "Non Grouped 1", Description = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); - contentType.AddPropertyType(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "nonGrouped2", Name = "Non Grouped 2", Description = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + contentType.AddPropertyType(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "nonGrouped1", Name = "Non Grouped 1", Description = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + contentType.AddPropertyType(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "nonGrouped2", Name = "Non Grouped 2", Description = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); //set ids or it wont work contentType.Id = idSeed; foreach (var p in contentType.PropertyTypes) diff --git a/src/Umbraco.Tests/Persistence/Mappers/DataTypeDefinitionMapperTest.cs b/src/Umbraco.Tests/Persistence/Mappers/DataTypeDefinitionMapperTest.cs index 54da940208..6832ba310d 100644 --- a/src/Umbraco.Tests/Persistence/Mappers/DataTypeDefinitionMapperTest.cs +++ b/src/Umbraco.Tests/Persistence/Mappers/DataTypeDefinitionMapperTest.cs @@ -47,16 +47,16 @@ namespace Umbraco.Tests.Persistence.Mappers } [Test] - public void Can_Map_ControlId_Property() + public void Can_Map_PropertyEditorAlias_Property() { // Arrange SqlSyntaxContext.SqlSyntaxProvider = SqlCeSyntax.Provider; // Act - string column = new DataTypeDefinitionMapper().Map("ControlId"); + string column = new DataTypeDefinitionMapper().Map("PropertyEditorAlias"); // Assert - Assert.That(column, Is.EqualTo("[cmsDataType].[controlId]")); + Assert.That(column, Is.EqualTo("[cmsDataType].[propertyEditorAlias]")); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs index c02030d75e..965757fcab 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs @@ -78,7 +78,7 @@ namespace Umbraco.Tests.Persistence.Repositories var contentType = repository.Get(1046); contentType.Thumbnail = "Doc2.png"; - contentType.PropertyGroups["Content"].PropertyTypes.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) + contentType.PropertyGroups["Content"].PropertyTypes.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "subtitle", Name = "Subtitle", @@ -239,7 +239,7 @@ namespace Umbraco.Tests.Persistence.Repositories var contentType = repository.Get(1046); // Act - var urlAlias = new PropertyType(new Guid(), DataTypeDatabaseType.Nvarchar) + var urlAlias = new PropertyType("test", DataTypeDatabaseType.Nvarchar) { Alias = "urlAlias", Name = "Url Alias", @@ -346,7 +346,7 @@ namespace Umbraco.Tests.Persistence.Repositories // Act var propertyGroup = contentType.PropertyGroups.First(x => x.Name == "Meta"); - propertyGroup.PropertyTypes.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "metaAuthor", Name = "Meta Author", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + propertyGroup.PropertyTypes.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "metaAuthor", Name = "Meta Author", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); repository.AddOrUpdate(contentType); unitOfWork.Commit(); @@ -370,7 +370,7 @@ namespace Umbraco.Tests.Persistence.Repositories unitOfWork.Commit(); var propertyGroup = contentType.PropertyGroups.First(x => x.Name == "Meta"); - propertyGroup.PropertyTypes.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "metaAuthor", Name = "Meta Author", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + propertyGroup.PropertyTypes.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "metaAuthor", Name = "Meta Author", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); repository.AddOrUpdate(contentType); unitOfWork.Commit(); @@ -407,7 +407,7 @@ namespace Umbraco.Tests.Persistence.Repositories contentType.RemovePropertyType("keywords"); //Add PropertyType var propertyGroup = contentType.PropertyGroups.First(x => x.Name == "Meta"); - propertyGroup.PropertyTypes.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "metaAuthor", Name = "Meta Author", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + propertyGroup.PropertyTypes.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "metaAuthor", Name = "Meta Author", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); repository.AddOrUpdate(contentType); unitOfWork.Commit(); diff --git a/src/Umbraco.Tests/Persistence/Repositories/MediaTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/MediaTypeRepositoryTest.cs index 71351a6489..31c43777f4 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/MediaTypeRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/MediaTypeRepositoryTest.cs @@ -70,7 +70,7 @@ namespace Umbraco.Tests.Persistence.Repositories var mediaType = repository.Get(1045); mediaType.Thumbnail = "Doc2.png"; - mediaType.PropertyGroups["Media"].PropertyTypes.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) + mediaType.PropertyGroups["Media"].PropertyTypes.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "subtitle", Name = "Subtitle", diff --git a/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs index efa50075bf..8979af2215 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs @@ -76,7 +76,7 @@ namespace Umbraco.Tests.PublishedContent var mType = MockedContentTypes.CreateImageMediaType(); //lets add an RTE to this mType.PropertyGroups.First().PropertyTypes.Add( - new PropertyType(new Guid(), DataTypeDatabaseType.Nvarchar) + new PropertyType("test", DataTypeDatabaseType.Nvarchar) { Alias = "content", Name = "Rich Text", diff --git a/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs b/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs index 90bc77a0b3..ddd827c78f 100644 --- a/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs @@ -313,7 +313,7 @@ namespace Umbraco.Tests.Services }; var contentCollection = new PropertyTypeCollection(); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "componentGroup", Name = "Component Group", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "componentGroup", Name = "Component Group", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); component.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Component", SortOrder = 1 }); return component; @@ -333,7 +333,7 @@ namespace Umbraco.Tests.Services Trashed = false }; - var propertyType = new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) + var propertyType = new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "bannerName", Name = "Banner Name", @@ -362,7 +362,7 @@ namespace Umbraco.Tests.Services }; var contentCollection = new PropertyTypeCollection(); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "hostname", Name = "Hostname", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "hostname", Name = "Hostname", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); site.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Site Settings", SortOrder = 1 }); return site; @@ -383,9 +383,9 @@ namespace Umbraco.Tests.Services }; var contentCollection = new PropertyTypeCollection(); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -87 }); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "author", Name = "Author", Description = "Name of the author", HelpText = "", Mandatory = false, SortOrder = 3, DataTypeDefinitionId = -88 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -87 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "author", Name = "Author", Description = "Name of the author", HelpText = "", Mandatory = false, SortOrder = 3, DataTypeDefinitionId = -88 }); contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", SortOrder = 1 }); diff --git a/src/Umbraco.Tests/Services/EntityServiceTests.cs b/src/Umbraco.Tests/Services/EntityServiceTests.cs index 427aa1a6c4..c6bf01245a 100644 --- a/src/Umbraco.Tests/Services/EntityServiceTests.cs +++ b/src/Umbraco.Tests/Services/EntityServiceTests.cs @@ -133,7 +133,7 @@ namespace Umbraco.Tests.Services entities.Any( x => ((UmbracoEntity) x).UmbracoProperties.Any( - y => y.DataTypeControlId == new Guid(Constants.PropertyEditors.UploadField))), Is.True); + y => y.PropertyEditorAlias == Constants.PropertyEditors.UploadFieldAlias)), Is.True); } public override void CreateTestData() diff --git a/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs b/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs index 9c144fe1ca..8ef80f63fb 100644 --- a/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs +++ b/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs @@ -24,12 +24,12 @@ namespace Umbraco.Tests.TestHelpers.Entities }; var contentCollection = new PropertyTypeCollection(); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -87 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -87 }); var metaCollection = new PropertyTypeCollection(); - metaCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "keywords", Name = "Meta Keywords", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); - metaCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "metaDescription", Name = "Meta Description", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -89 }); + metaCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "keywords", Name = "Meta Keywords", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + metaCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "metaDescription", Name = "Meta Description", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -89 }); contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", SortOrder = 1 }); contentType.PropertyGroups.Add(new PropertyGroup(metaCollection) { Name = "Meta", SortOrder = 2 }); @@ -55,8 +55,8 @@ namespace Umbraco.Tests.TestHelpers.Entities }; var metaCollection = new PropertyTypeCollection(); - metaCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "metakeywords", Name = "Meta Keywords", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); - metaCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "metadescription", Name = "Meta Description", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -89 }); + metaCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "metakeywords", Name = "Meta Keywords", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + metaCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "metadescription", Name = "Meta Description", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -89 }); contentType.PropertyGroups.Add(new PropertyGroup(metaCollection) { Name = "Meta", SortOrder = 2 }); @@ -81,9 +81,9 @@ namespace Umbraco.Tests.TestHelpers.Entities }; var contentCollection = new PropertyTypeCollection(); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -87 }); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "author", Name = "Author", Description = "Name of the author", HelpText = "", Mandatory = false, SortOrder = 3, DataTypeDefinitionId = -88 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -87 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "author", Name = "Author", Description = "Name of the author", HelpText = "", Mandatory = false, SortOrder = 3, DataTypeDefinitionId = -88 }); contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", SortOrder = 1 }); @@ -107,9 +107,9 @@ namespace Umbraco.Tests.TestHelpers.Entities contentType.Trashed = false; var contentCollection = new PropertyTypeCollection(); - contentCollection.Add(new PropertyType(new Guid("ec15c1e5-9d90-422a-aa52-4f7622c63bea"), DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); - contentCollection.Add(new PropertyType(new Guid("5E9B75AE-FACE-41c8-B47E-5F4B0FD82F83"), DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -87 }); - contentCollection.Add(new PropertyType(new Guid("ec15c1e5-9d90-422a-aa52-4f7622c63bea"), DataTypeDatabaseType.Ntext) { Alias = "author", Name = "Author", Description = "Name of the author", HelpText = "", Mandatory = false, SortOrder = 3, DataTypeDefinitionId = -88 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.TextboxAlias, DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.TinyMCEv3Alias, DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -87 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.TextboxAlias, DataTypeDatabaseType.Ntext) { Alias = "author", Name = "Author", Description = "Name of the author", HelpText = "", Mandatory = false, SortOrder = 3, DataTypeDefinitionId = -88 }); contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", SortOrder = 1 }); @@ -134,9 +134,9 @@ namespace Umbraco.Tests.TestHelpers.Entities }; var contentCollection = new PropertyTypeCollection(); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = mandatory, SortOrder = 1, DataTypeDefinitionId = -88 }); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Description = "", HelpText = "", Mandatory = mandatory, SortOrder = 2, DataTypeDefinitionId = -87 }); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "author", Name = "Author", Description = "Name of the author", HelpText = "", Mandatory = mandatory, SortOrder = 3, DataTypeDefinitionId = -88 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = mandatory, SortOrder = 1, DataTypeDefinitionId = -88 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Description = "", HelpText = "", Mandatory = mandatory, SortOrder = 2, DataTypeDefinitionId = -87 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "author", Name = "Author", Description = "Name of the author", HelpText = "", Mandatory = mandatory, SortOrder = 3, DataTypeDefinitionId = -88 }); contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", SortOrder = 1 }); @@ -195,30 +195,30 @@ namespace Umbraco.Tests.TestHelpers.Entities }; var contentCollection = new PropertyTypeCollection(); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.TrueFalse), DataTypeDatabaseType.Integer) { Alias = "isTrue", Name = "Is True or False", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -49 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.Integer), DataTypeDatabaseType.Integer) { Alias = "number", Name = "Number", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -51 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.TinyMCEv3), DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Mandatory = false, SortOrder = 3, DataTypeDefinitionId = -87 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.Textbox), DataTypeDatabaseType.Nvarchar) { Alias = "singleLineText", Name = "Text String", Mandatory = false, SortOrder = 4, DataTypeDefinitionId = -88 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.TextboxMultiple), DataTypeDatabaseType.Ntext) { Alias = "multilineText", Name = "Multiple Text Strings", Mandatory = false, SortOrder = 5, DataTypeDefinitionId = -89 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.UploadField), DataTypeDatabaseType.Nvarchar) { Alias = "upload", Name = "Upload Field", Mandatory = false, SortOrder = 6, DataTypeDefinitionId = -90 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.NoEdit), DataTypeDatabaseType.Nvarchar) { Alias = "label", Name = "Label", Mandatory = false, SortOrder = 7, DataTypeDefinitionId = -92 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.DateTime), DataTypeDatabaseType.Date) { Alias = "dateTime", Name = "Date Time", Mandatory = false, SortOrder = 8, DataTypeDefinitionId = -36 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.ColorPicker), DataTypeDatabaseType.Nvarchar) { Alias = "colorPicker", Name = "Color Picker", Mandatory = false, SortOrder = 9, DataTypeDefinitionId = -37 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.FolderBrowser), DataTypeDatabaseType.Nvarchar) { Alias = "folderBrowser", Name = "Folder Browser", Mandatory = false, SortOrder = 10, DataTypeDefinitionId = -38 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.DropDownListMultiple), DataTypeDatabaseType.Nvarchar) { Alias = "ddlMultiple", Name = "Dropdown List Multiple", Mandatory = false, SortOrder = 11, DataTypeDefinitionId = -39 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.RadioButtonList), DataTypeDatabaseType.Nvarchar) { Alias = "rbList", Name = "Radio Button List", Mandatory = false, SortOrder = 12, DataTypeDefinitionId = -40 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.Date), DataTypeDatabaseType.Date) { Alias = "date", Name = "Date", Mandatory = false, SortOrder = 13, DataTypeDefinitionId = -41 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.DropDownList), DataTypeDatabaseType.Integer) { Alias = "ddl", Name = "Dropdown List", Mandatory = false, SortOrder = 14, DataTypeDefinitionId = -42 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.CheckBoxList), DataTypeDatabaseType.Nvarchar) { Alias = "chklist", Name = "Checkbox List", Mandatory = false, SortOrder = 15, DataTypeDefinitionId = -43 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.ContentPicker), DataTypeDatabaseType.Integer) { Alias = "contentPicker", Name = "Content Picker", Mandatory = false, SortOrder = 16, DataTypeDefinitionId = 1034 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.MediaPicker), DataTypeDatabaseType.Integer) { Alias = "mediaPicker", Name = "Media Picker", Mandatory = false, SortOrder = 17, DataTypeDefinitionId = 1035 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.MemberPicker), DataTypeDatabaseType.Integer) { Alias = "memberPicker", Name = "Member Picker", Mandatory = false, SortOrder = 18, DataTypeDefinitionId = 1036 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.UltraSimpleEditor), DataTypeDatabaseType.Ntext) { Alias = "simpleEditor", Name = "Ultra Simple Editor", Mandatory = false, SortOrder = 19, DataTypeDefinitionId = 1038 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.UltimatePicker), DataTypeDatabaseType.Ntext) { Alias = "ultimatePicker", Name = "Ultimate Picker", Mandatory = false, SortOrder = 20, DataTypeDefinitionId = 1039 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.RelatedLinks), DataTypeDatabaseType.Ntext) { Alias = "relatedLinks", Name = "Related Links", Mandatory = false, SortOrder = 21, DataTypeDefinitionId = 1040 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.Tags), DataTypeDatabaseType.Ntext) { Alias = "tags", Name = "Tags", Mandatory = false, SortOrder = 22, DataTypeDefinitionId = 1041 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.MacroContainer), DataTypeDatabaseType.Ntext) { Alias = "macroContainer", Name = "Macro Container", Mandatory = false, SortOrder = 23, DataTypeDefinitionId = 1042 }); - contentCollection.Add(new PropertyType(new Guid(Constants.PropertyEditors.ImageCropper), DataTypeDatabaseType.Ntext) { Alias = "imgCropper", Name = "Image Cropper", Mandatory = false, SortOrder = 24, DataTypeDefinitionId = 1043 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.TrueFalseAlias, DataTypeDatabaseType.Integer) { Alias = "isTrue", Name = "Is True or False", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -49 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.IntegerAlias, DataTypeDatabaseType.Integer) { Alias = "number", Name = "Number", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -51 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.TinyMCEv3Alias, DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Mandatory = false, SortOrder = 3, DataTypeDefinitionId = -87 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.TextboxAlias, DataTypeDatabaseType.Nvarchar) { Alias = "singleLineText", Name = "Text String", Mandatory = false, SortOrder = 4, DataTypeDefinitionId = -88 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.TextboxMultipleAlias, DataTypeDatabaseType.Ntext) { Alias = "multilineText", Name = "Multiple Text Strings", Mandatory = false, SortOrder = 5, DataTypeDefinitionId = -89 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.UploadFieldAlias, DataTypeDatabaseType.Nvarchar) { Alias = "upload", Name = "Upload Field", Mandatory = false, SortOrder = 6, DataTypeDefinitionId = -90 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.NoEditAlias, DataTypeDatabaseType.Nvarchar) { Alias = "label", Name = "Label", Mandatory = false, SortOrder = 7, DataTypeDefinitionId = -92 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.DateTimeAlias, DataTypeDatabaseType.Date) { Alias = "dateTime", Name = "Date Time", Mandatory = false, SortOrder = 8, DataTypeDefinitionId = -36 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.ColorPickerAlias, DataTypeDatabaseType.Nvarchar) { Alias = "colorPicker", Name = "Color Picker", Mandatory = false, SortOrder = 9, DataTypeDefinitionId = -37 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.FolderBrowserAlias, DataTypeDatabaseType.Nvarchar) { Alias = "folderBrowser", Name = "Folder Browser", Mandatory = false, SortOrder = 10, DataTypeDefinitionId = -38 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.DropDownListMultipleAlias, DataTypeDatabaseType.Nvarchar) { Alias = "ddlMultiple", Name = "Dropdown List Multiple", Mandatory = false, SortOrder = 11, DataTypeDefinitionId = -39 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.RadioButtonListAlias, DataTypeDatabaseType.Nvarchar) { Alias = "rbList", Name = "Radio Button List", Mandatory = false, SortOrder = 12, DataTypeDefinitionId = -40 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.DateAlias, DataTypeDatabaseType.Date) { Alias = "date", Name = "Date", Mandatory = false, SortOrder = 13, DataTypeDefinitionId = -41 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.DropDownListAlias, DataTypeDatabaseType.Integer) { Alias = "ddl", Name = "Dropdown List", Mandatory = false, SortOrder = 14, DataTypeDefinitionId = -42 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.CheckBoxListAlias, DataTypeDatabaseType.Nvarchar) { Alias = "chklist", Name = "Checkbox List", Mandatory = false, SortOrder = 15, DataTypeDefinitionId = -43 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.ContentPickerAlias, DataTypeDatabaseType.Integer) { Alias = "contentPicker", Name = "Content Picker", Mandatory = false, SortOrder = 16, DataTypeDefinitionId = 1034 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.MediaPickerAlias, DataTypeDatabaseType.Integer) { Alias = "mediaPicker", Name = "Media Picker", Mandatory = false, SortOrder = 17, DataTypeDefinitionId = 1035 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.MemberPickerAlias, DataTypeDatabaseType.Integer) { Alias = "memberPicker", Name = "Member Picker", Mandatory = false, SortOrder = 18, DataTypeDefinitionId = 1036 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.UltraSimpleEditorAlias, DataTypeDatabaseType.Ntext) { Alias = "simpleEditor", Name = "Ultra Simple Editor", Mandatory = false, SortOrder = 19, DataTypeDefinitionId = 1038 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.UltimatePickerAlias, DataTypeDatabaseType.Ntext) { Alias = "ultimatePicker", Name = "Ultimate Picker", Mandatory = false, SortOrder = 20, DataTypeDefinitionId = 1039 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.RelatedLinksAlias, DataTypeDatabaseType.Ntext) { Alias = "relatedLinks", Name = "Related Links", Mandatory = false, SortOrder = 21, DataTypeDefinitionId = 1040 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.TagsAlias, DataTypeDatabaseType.Ntext) { Alias = "tags", Name = "Tags", Mandatory = false, SortOrder = 22, DataTypeDefinitionId = 1041 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.MacroContainerAlias, DataTypeDatabaseType.Ntext) { Alias = "macroContainer", Name = "Macro Container", Mandatory = false, SortOrder = 23, DataTypeDefinitionId = 1042 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.ImageCropperAlias, DataTypeDatabaseType.Ntext) { Alias = "imgCropper", Name = "Image Cropper", Mandatory = false, SortOrder = 24, DataTypeDefinitionId = 1043 }); contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", SortOrder = 1 }); @@ -240,8 +240,8 @@ namespace Umbraco.Tests.TestHelpers.Entities }; var contentCollection = new PropertyTypeCollection(); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Nvarchar) { Alias = "videoFile", Name = "Video File", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Nvarchar) { Alias = "videoFile", Name = "Video File", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); mediaType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Media", SortOrder = 1 }); @@ -266,11 +266,11 @@ namespace Umbraco.Tests.TestHelpers.Entities }; var contentCollection = new PropertyTypeCollection(); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Nvarchar) { Alias = Constants.Conventions.Media.File, Name = "File", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -90 }); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Integer) { Alias = Constants.Conventions.Media.Width, Name = "Width", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Integer) { Alias = Constants.Conventions.Media.Height, Name = "Height", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Integer) { Alias = Constants.Conventions.Media.Bytes, Name = "Bytes", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); - contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Integer) { Alias = Constants.Conventions.Media.Extension, Name = "File Extension", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Nvarchar) { Alias = Constants.Conventions.Media.File, Name = "File", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -90 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Integer) { Alias = Constants.Conventions.Media.Width, Name = "Width", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Integer) { Alias = Constants.Conventions.Media.Height, Name = "Height", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Integer) { Alias = Constants.Conventions.Media.Bytes, Name = "Bytes", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); + contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Integer) { Alias = Constants.Conventions.Media.Extension, Name = "File Extension", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); mediaType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Media", SortOrder = 1 }); diff --git a/src/Umbraco.Web/WebServices/FolderBrowserService.cs b/src/Umbraco.Web/WebServices/FolderBrowserService.cs index 22d51c33cd..97b0b3fd8c 100644 --- a/src/Umbraco.Web/WebServices/FolderBrowserService.cs +++ b/src/Umbraco.Web/WebServices/FolderBrowserService.cs @@ -31,7 +31,7 @@ namespace Umbraco.Web.WebServices var entities = service.GetChildren(parentId, UmbracoObjectTypes.Media); foreach (UmbracoEntity entity in entities) { - var uploadFieldProperty = entity.UmbracoProperties.FirstOrDefault(x => x.DataTypeControlId == new Guid(Constants.PropertyEditors.UploadField)); + var uploadFieldProperty = entity.UmbracoProperties.FirstOrDefault(x => x.PropertyEditorAlias == Constants.PropertyEditors.UploadFieldAlias); var thumbnailUrl = uploadFieldProperty == null ? "" : ThumbnailProvidersResolver.Current.GetThumbnailUrl(uploadFieldProperty.Value); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseMediaTree.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseMediaTree.cs index 0c2d24f0a2..7715d5709b 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseMediaTree.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseMediaTree.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using Umbraco.Core.Logging; using Umbraco.Core.Models; +using Umbraco.Core.Persistence; using umbraco.BasePages; using umbraco.BusinessLogic; using umbraco.BusinessLogic.Actions; @@ -168,9 +169,14 @@ function openMedia(id) { { foreach (var property in entity.UmbracoProperties) { - if (LinkableMediaDataTypes.Contains(property.DataTypeControlId) && - string.IsNullOrEmpty(property.Value) == false) - return property.Value; + //required for backwards compatibility with v7 with changing the GUID -> alias + var controlId = LegacyPropertyEditorIdToAliasConverter.GetLegacyIdFromAlias(property.PropertyEditorAlias); + if (controlId != null) + { + if (LinkableMediaDataTypes.Contains(controlId.Value) && + string.IsNullOrEmpty(property.Value) == false) + return property.Value; + } } return ""; } diff --git a/src/umbraco.cms/businesslogic/datatype/DataTypeDefinition.cs b/src/umbraco.cms/businesslogic/datatype/DataTypeDefinition.cs index 89656fb95b..d4aa18ba47 100644 --- a/src/umbraco.cms/businesslogic/datatype/DataTypeDefinition.cs +++ b/src/umbraco.cms/businesslogic/datatype/DataTypeDefinition.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using System.Linq; using Umbraco.Core.Cache; +using Umbraco.Core.Persistence; using umbraco.DataLayer; using System.Xml; using umbraco.cms.businesslogic.media; @@ -23,7 +24,7 @@ namespace umbraco.cms.businesslogic.datatype public class DataTypeDefinition : CMSNode { #region Private fields - private Guid _controlId; + private string _propertyEditorAlias; private static Guid _objectType = new Guid(Constants.ObjectTypes.DataType); private string _dbType; @@ -54,10 +55,12 @@ namespace umbraco.cms.businesslogic.datatype { get { - if (_controlId == Guid.Empty) + if (_propertyEditorAlias.IsNullOrWhiteSpace()) return null; - var dt = DataTypesResolver.Current.GetById(_controlId); + var controlId = LegacyPropertyEditorIdToAliasConverter.GetLegacyIdFromAlias(_propertyEditorAlias, true); + + var dt = DataTypesResolver.Current.GetById(controlId.Value); if (dt != null) dt.DataTypeDefinitionId = Id; @@ -73,7 +76,10 @@ namespace umbraco.cms.businesslogic.datatype SqlHelper.ExecuteNonQuery("update cmsDataType set controlId = @id where nodeID = " + this.Id.ToString(), SqlHelper.CreateParameter("@id", value.Id)); - _controlId = value.Id; + + var alias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(value.Id, true); + + _propertyEditorAlias = alias; } } internal string DbType @@ -311,7 +317,7 @@ namespace umbraco.cms.businesslogic.datatype { if (dr.Read()) { - _controlId = dr.GetGuid("controlId"); + _propertyEditorAlias = dr.GetString("propertyEditorAlias"); _dbType = dr.GetString("dbType"); } else