From d7477eaf6d20417833efd2580dcb91d05c19f1ad Mon Sep 17 00:00:00 2001 From: leekelleher Date: Tue, 1 Jul 2014 16:49:20 +0100 Subject: [PATCH] Moved the `ArchetypePropertyModel.CreateDummyPropertyType` to an extension method. With a view to re-use in the Courier DataResolver (as it does the same function). --- .../Models/ArchetypePropertyModel.cs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/app/Umbraco/Umbraco.Archetype/Models/ArchetypePropertyModel.cs b/app/Umbraco/Umbraco.Archetype/Models/ArchetypePropertyModel.cs index 66773df..4d9abb4 100644 --- a/app/Umbraco/Umbraco.Archetype/Models/ArchetypePropertyModel.cs +++ b/app/Umbraco/Umbraco.Archetype/Models/ArchetypePropertyModel.cs @@ -1,15 +1,16 @@ using System.Collections.Generic; using System.Linq; +using Archetype.Extensions; using Newtonsoft.Json; using Umbraco.Core; -using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; using Umbraco.Core.PropertyEditors; using Umbraco.Web; namespace Archetype.Models { - public class ArchetypePropertyModel { + public class ArchetypePropertyModel + { [JsonProperty("alias")] public string Alias { get; internal set; } @@ -54,7 +55,7 @@ namespace Archetype.Models private Attempt TryConvertWithPropertyValueConverters(object value, IEnumerable converters) { - var properyType = CreateDummyPropertyType(DataTypeId, PropertyEditorAlias); + var properyType = this.CreateDummyPropertyType(); // In umbraco, there are default value converters that try to convert the // value if all else fails. The problem is, they are also in the list of @@ -80,14 +81,5 @@ namespace Archetype.Models return Attempt.Fail(); } - - private PublishedPropertyType CreateDummyPropertyType(int dataTypeId, string propertyEditorAlias) - { - return new PublishedPropertyType(this.HostContentType, - new PropertyType(new DataTypeDefinition(-1, propertyEditorAlias) - { - Id = dataTypeId - })); - } } -} +} \ No newline at end of file