diff --git a/src/Umbraco.Core/Models/DataTypeDefinition.cs b/src/Umbraco.Core/Models/DataTypeDefinition.cs index ee5c686914..8bdb1aa088 100644 --- a/src/Umbraco.Core/Models/DataTypeDefinition.cs +++ b/src/Umbraco.Core/Models/DataTypeDefinition.cs @@ -2,7 +2,6 @@ using System.Reflection; using System.Runtime.Serialization; using Umbraco.Core.Models.EntityBase; -using Umbraco.Core.Models.Membership; namespace Umbraco.Core.Models { @@ -22,7 +21,7 @@ namespace Umbraco.Core.Models private int _sortOrder; private int _level; private string _path; - private IProfile _creator; + private int _creatorId; private bool _trashed; private Guid _controlId; private DataTypeDatabaseType _databaseType; @@ -38,7 +37,7 @@ namespace Umbraco.Core.Models private static readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo(x => x.SortOrder); private static readonly PropertyInfo LevelSelector = ExpressionHelper.GetPropertyInfo(x => x.Level); private static readonly PropertyInfo PathSelector = ExpressionHelper.GetPropertyInfo(x => x.Path); - private static readonly PropertyInfo UserIdSelector = ExpressionHelper.GetPropertyInfo(x => x.Creator); + 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 DatabaseTypeSelector = ExpressionHelper.GetPropertyInfo(x => x.DatabaseType); @@ -118,12 +117,12 @@ namespace Umbraco.Core.Models /// Id of the user who created this entity /// [DataMember] - public IProfile Creator + public int CreatorId { - get { return _creator; } + get { return _creatorId; } set { - _creator = value; + _creatorId = value; OnPropertyChanged(UserIdSelector); } } @@ -169,5 +168,11 @@ namespace Umbraco.Core.Models OnPropertyChanged(DatabaseTypeSelector); } } + + internal override void AddingEntity() + { + base.AddingEntity(); + Key = Guid.NewGuid(); + } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Models/IDataTypeDefinition.cs b/src/Umbraco.Core/Models/IDataTypeDefinition.cs index e04820940a..12b5f4ddb5 100644 --- a/src/Umbraco.Core/Models/IDataTypeDefinition.cs +++ b/src/Umbraco.Core/Models/IDataTypeDefinition.cs @@ -1,7 +1,6 @@ using System; using System.Runtime.Serialization; using Umbraco.Core.Models.EntityBase; -using Umbraco.Core.Models.Membership; namespace Umbraco.Core.Models { @@ -42,7 +41,7 @@ namespace Umbraco.Core.Models /// Id of the user who created this entity /// [DataMember] - IProfile Creator { get; set; } + int CreatorId { get; set; } /// /// Boolean indicating whether this entity is Trashed or not. diff --git a/src/Umbraco.Core/Persistence/Factories/DataTypeDefinitionFactory.cs b/src/Umbraco.Core/Persistence/Factories/DataTypeDefinitionFactory.cs index f9243f5a0d..bda5f5e209 100644 --- a/src/Umbraco.Core/Persistence/Factories/DataTypeDefinitionFactory.cs +++ b/src/Umbraco.Core/Persistence/Factories/DataTypeDefinitionFactory.cs @@ -1,7 +1,6 @@ using System; using System.Globalization; using Umbraco.Core.Models; -using Umbraco.Core.Models.Membership; using Umbraco.Core.Models.Rdbms; namespace Umbraco.Core.Persistence.Factories @@ -36,7 +35,7 @@ namespace Umbraco.Core.Persistence.Factories Path = dto.NodeDto.Path, SortOrder = dto.NodeDto.SortOrder, Trashed = dto.NodeDto.Trashed, - Creator = new Profile(dto.NodeDto.UserId.Value, "") + CreatorId = dto.NodeDto.UserId.Value }; return dataTypeDefinition; @@ -81,7 +80,7 @@ namespace Umbraco.Core.Persistence.Factories Text = entity.Name, Trashed = entity.Trashed, UniqueId = entity.Key, - UserId = entity.Creator.Id.SafeCast() + UserId = entity.CreatorId }; return nodeDto; diff --git a/src/Umbraco.Core/Persistence/Mappers/DataTypeDefinitionMapper.cs b/src/Umbraco.Core/Persistence/Mappers/DataTypeDefinitionMapper.cs index 1ff7507c3b..837b09f987 100644 --- a/src/Umbraco.Core/Persistence/Mappers/DataTypeDefinitionMapper.cs +++ b/src/Umbraco.Core/Persistence/Mappers/DataTypeDefinitionMapper.cs @@ -34,7 +34,7 @@ namespace Umbraco.Core.Persistence.Mappers CacheMap(src => src.Name, dto => dto.Text); CacheMap(src => src.Trashed, dto => dto.Trashed); CacheMap(src => src.Key, dto => dto.UniqueId); - CacheMap(src => src.Creator, dto => dto.UserId); + CacheMap(src => src.CreatorId, dto => dto.UserId); CacheMap(src => src.ControlId, dto => dto.ControlId); CacheMap(src => src.DatabaseType, dto => dto.DbType); diff --git a/src/Umbraco.Core/Services/IDataTypeService.cs b/src/Umbraco.Core/Services/IDataTypeService.cs index 8b5fa73d15..d900a2c473 100644 --- a/src/Umbraco.Core/Services/IDataTypeService.cs +++ b/src/Umbraco.Core/Services/IDataTypeService.cs @@ -36,7 +36,7 @@ namespace Umbraco.Core.Services /// /// to save /// Id of the user issueing the save - void Save(IDataTypeDefinition dataTypeDefinition, int userId); + void Save(IDataTypeDefinition dataTypeDefinition, int userId = -1); /// /// Deletes an diff --git a/src/Umbraco.Tests/CodeFirst/Attributes/PropertyTypeAttribute.cs b/src/Umbraco.Tests/CodeFirst/Attributes/PropertyTypeAttribute.cs index a2ef0f654e..2e13cfcfb6 100644 --- a/src/Umbraco.Tests/CodeFirst/Attributes/PropertyTypeAttribute.cs +++ b/src/Umbraco.Tests/CodeFirst/Attributes/PropertyTypeAttribute.cs @@ -1,9 +1,11 @@ using System; +using Umbraco.Core.Models; +using Umbraco.Tests.CodeFirst.Definitions; namespace Umbraco.Tests.CodeFirst.Attributes { [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] - public class PropertyTypeAttribute : Attribute + public class PropertyTypeAttribute : PropertyTypeConventionAttribute { public PropertyTypeAttribute(Type type) { @@ -11,6 +13,7 @@ namespace Umbraco.Tests.CodeFirst.Attributes PropertyGroup = "Generic Properties"; Mandatory = false; ValidationRegExp = string.Empty; + DatabaseType = DataTypeDatabaseType.Nvarchar; } /// @@ -18,6 +21,15 @@ namespace Umbraco.Tests.CodeFirst.Attributes /// public Type Type { get; private set; } + /// + /// Gets or sets the Database Type to use for the chosen DataType. + /// + /// + /// Please note that the DatabaseType only needs to be set when + /// creating a new DataType definition. + /// + public DataTypeDatabaseType DatabaseType { get; set; } + /// /// Gets or sets the Name of the PropertyGroup that this PropertyType belongs to /// @@ -32,5 +44,17 @@ namespace Umbraco.Tests.CodeFirst.Attributes /// Regular Expression for validating PropertyType's values /// public string ValidationRegExp { get; set; } + + public override PropertyDefinition GetPropertyConvention() + { + var definition = new PropertyDefinition(); + + definition.Mandatory = Mandatory; + definition.ValidationRegExp = string.IsNullOrEmpty(ValidationRegExp) ? ValidationRegExp : string.Empty; + definition.PropertyGroup = string.IsNullOrEmpty(PropertyGroup) ? "Generic Properties" : PropertyGroup; + definition.DataTypeDefinition = Conventions.DataTypeConvention(this, Type); + + return definition; + } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/CodeFirst/Attributes/PropertyTypeConventionAttribute.cs b/src/Umbraco.Tests/CodeFirst/Attributes/PropertyTypeConventionAttribute.cs new file mode 100644 index 0000000000..c1ae255b47 --- /dev/null +++ b/src/Umbraco.Tests/CodeFirst/Attributes/PropertyTypeConventionAttribute.cs @@ -0,0 +1,11 @@ +using System; +using Umbraco.Tests.CodeFirst.Definitions; + +namespace Umbraco.Tests.CodeFirst.Attributes +{ + [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] + public abstract class PropertyTypeConventionAttribute : Attribute + { + public abstract PropertyDefinition GetPropertyConvention(); + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/CodeFirst/CodeFirstTests.cs b/src/Umbraco.Tests/CodeFirst/CodeFirstTests.cs index bb5f31c53c..0c14672fac 100644 --- a/src/Umbraco.Tests/CodeFirst/CodeFirstTests.cs +++ b/src/Umbraco.Tests/CodeFirst/CodeFirstTests.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Reflection; using NUnit.Framework; using Umbraco.Core; using Umbraco.Core.Configuration; @@ -9,6 +10,7 @@ using Umbraco.Core.IO; using Umbraco.Core.Models; using Umbraco.Core.ObjectResolution; using Umbraco.Core.Serialization; +using Umbraco.Tests.CodeFirst.Attributes; using Umbraco.Tests.CodeFirst.Definitions; using Umbraco.Tests.CodeFirst.TestModels; using Umbraco.Tests.TestHelpers; @@ -45,6 +47,21 @@ namespace Umbraco.Tests.CodeFirst SerializationService = new SerializationService(serviceStackSerializer); } + [Test] + public void Can_Create_Model_With_NonExisting_DataTypeDefinition() + { + ContentTypeDefinitionFactory.ClearContentTypeCache(); + + var modelType = typeof(ModelWithNewDataType); + var contentType = ContentTypeDefinitionFactory.GetContentTypeDefinition(modelType); + + var mappedContentTypes = ContentTypeDefinitionFactory.RetrieveMappedContentTypes(); + ServiceContext.ContentTypeService.Save(mappedContentTypes); + + var model = ServiceContext.ContentTypeService.GetContentType(1046); + Assert.That(model, Is.Not.Null); + } + [Test] public void Can_Resolve_ContentType_From_Decorated_Home_Model() { diff --git a/src/Umbraco.Tests/CodeFirst/Definitions/ContentTypeDefinitionFactory.cs b/src/Umbraco.Tests/CodeFirst/Definitions/ContentTypeDefinitionFactory.cs index 68b4a1b57f..a88f27b1c4 100644 --- a/src/Umbraco.Tests/CodeFirst/Definitions/ContentTypeDefinitionFactory.cs +++ b/src/Umbraco.Tests/CodeFirst/Definitions/ContentTypeDefinitionFactory.cs @@ -8,7 +8,6 @@ using Umbraco.Core.Configuration; using Umbraco.Core.Models; using Umbraco.Core.Services; using Umbraco.Tests.CodeFirst.Attributes; -using umbraco.interfaces; namespace Umbraco.Tests.CodeFirst.Definitions { @@ -43,29 +42,44 @@ namespace Umbraco.Tests.CodeFirst.Definitions var objProperties = modelType.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly).ToList(); foreach (var propertyInfo in objProperties) { - var definition = new PropertyDefinition(); + var propertyTypeAttribute = propertyInfo.FirstAttribute(); + var definition = propertyTypeAttribute == null + ? new PropertyDefinition() + : propertyTypeAttribute.GetPropertyConvention(); - var aliasAttribute = propertyInfo.FirstAttribute(); - definition.Alias = PropertyTypeAliasConvention(aliasAttribute, propertyInfo.Name); - definition.Name = PropertyTypeNameConvention(aliasAttribute, propertyInfo.Name); - - var descriptionAttribute = propertyInfo.FirstAttribute(); - definition.Description = descriptionAttribute != null ? descriptionAttribute.Description : string.Empty; - - var sortOrderAttribute = propertyInfo.FirstAttribute(); - definition.Order = sortOrderAttribute != null ? sortOrderAttribute.Order : order; - - var propertyTypeAttribute = propertyInfo.FirstAttribute(); - definition.Mandatory = propertyTypeAttribute != null && propertyTypeAttribute.Mandatory; - definition.ValidationRegExp = propertyTypeAttribute == null ? string.Empty : propertyTypeAttribute.ValidationRegExp; - definition.PropertyGroup = propertyTypeAttribute == null ? "Generic Properties" : propertyTypeAttribute.PropertyGroup; - definition.DataTypeDefinition = DataTypeConvention(propertyTypeAttribute, propertyInfo.PropertyType); - - //RichtextAttribute convention - var richtextAttribute = propertyInfo.FirstAttribute(); - if(richtextAttribute != null) + //DataTypeDefinition fallback + if(definition.DataTypeDefinition == null) { - definition.DataTypeDefinition = DataTypeConvention(richtextAttribute, propertyInfo.PropertyType); + definition.DataTypeDefinition = Conventions.DataTypeConvention(null, propertyInfo.PropertyType); + } + + if(string.IsNullOrEmpty(definition.PropertyGroup)) + { + definition.PropertyGroup = "Generic Properties"; + } + + //Alias fallback + if (string.IsNullOrEmpty(definition.Alias)) + { + var aliasAttribute = propertyInfo.FirstAttribute(); + definition.Alias = Conventions.PropertyTypeAliasConvention(aliasAttribute, propertyInfo.Name); + definition.Name = Conventions.PropertyTypeNameConvention(aliasAttribute, propertyInfo.Name); + } + + //Description fallback + if (string.IsNullOrEmpty(definition.Description)) + { + var descriptionAttribute = propertyInfo.FirstAttribute(); + definition.Description = descriptionAttribute != null + ? descriptionAttribute.Description + : string.Empty; + } + + //SortOrder fallback + if (definition.Order == default(int)) + { + var sortOrderAttribute = propertyInfo.FirstAttribute(); + definition.Order = sortOrderAttribute != null ? sortOrderAttribute.Order : order; } definitions.Add(definition); @@ -177,84 +191,6 @@ namespace Umbraco.Tests.CodeFirst.Definitions _contentTypeCache.Clear(); } - /// - /// Convention to get a DataTypeDefinition from the PropertyTypeAttribute or the type of the property itself - /// - /// - /// - /// - private static IDataTypeDefinition DataTypeConvention(PropertyTypeAttribute attribute, Type type) - { - if(attribute != null) - { - var instance = Activator.CreateInstance(attribute.Type); - var dataType = instance as IDataType; - return GetDataTypeByControlId(dataType.Id); - } - - return TypeToPredefinedDataTypeConvention(type); - } - - /// - /// Convention to get predefined DataTypeDefinitions based on the Type of the property - /// - /// - /// - private static IDataTypeDefinition TypeToPredefinedDataTypeConvention(Type type) - { - if(type == typeof(bool)) - { - return GetDataTypeByControlId(new Guid("38b352c1-e9f8-4fd8-9324-9a2eab06d97a"));// Yes/No DataType - } - if(type == typeof(int)) - { - return GetDataTypeByControlId(new Guid("1413afcb-d19a-4173-8e9a-68288d2a73b8"));// Number DataType - } - if(type == typeof(DateTime)) - { - return GetDataTypeByControlId(new Guid("23e93522-3200-44e2-9f29-e61a6fcbb79a"));// Date Picker DataType - } - - return GetDataTypeByControlId(new Guid("ec15c1e5-9d90-422a-aa52-4f7622c63bea"));// Standard textfield - } - - /// - /// Gets the from the DataTypeService by its control Id - /// - /// - /// - private static IDataTypeDefinition GetDataTypeByControlId(Guid id) - { - //TODO Create Definition if none exists - var definition = ServiceFactory.DataTypeService.GetDataTypeDefinitionByControlId(id); - return definition.FirstOrDefault(); - } - - /// - /// Convention to get the Alias of the PropertyType from the AliasAttribute or the property itself - /// - /// - /// - /// - private static string PropertyTypeAliasConvention(AliasAttribute attribute, string propertyName) - { - return attribute == null ? propertyName.ToUmbracoAlias() : attribute.Alias; - } - - /// - /// Convention to get the Name of the PropertyType from the AliasAttribute or the property itself - /// - /// - /// - /// - private static string PropertyTypeNameConvention(AliasAttribute attribute, string propertyName) - { - if (attribute == null) - return propertyName.SplitPascalCasing(); - - return string.IsNullOrEmpty(attribute.Name) ? propertyName.SplitPascalCasing() : attribute.Name; - } - /// /// Convention that converts a class decorated with the ContentTypeAttribute to an initial ContentType /// @@ -314,13 +250,14 @@ namespace Umbraco.Tests.CodeFirst.Definitions var @alias = engine == RenderingEngine.Mvc ? templateName.Replace(".cshtml", "").Replace(".vbhtml", "") : templateName.Replace(".masterpage", ""); - var name = engine == RenderingEngine.Mvc - ? string.Concat(@alias, ".cshtml") - : string.Concat(@alias, ".masterpage"); var template = ServiceFactory.FileService.GetTemplateByAlias(@alias); if(template == null) { + var name = engine == RenderingEngine.Mvc + ? string.Concat(@alias, ".cshtml") + : string.Concat(@alias, ".masterpage"); + template = new Template(string.Empty, name, @alias) { CreatorId = 0, Content = string.Empty}; ServiceFactory.FileService.SaveTemplate(template); } diff --git a/src/Umbraco.Tests/CodeFirst/Definitions/Conventions.cs b/src/Umbraco.Tests/CodeFirst/Definitions/Conventions.cs new file mode 100644 index 0000000000..91385bd22b --- /dev/null +++ b/src/Umbraco.Tests/CodeFirst/Definitions/Conventions.cs @@ -0,0 +1,101 @@ +using System; +using System.Linq; +using Umbraco.Core; +using Umbraco.Core.Models; +using Umbraco.Core.Services; +using Umbraco.Tests.CodeFirst.Attributes; +using umbraco.interfaces; + +namespace Umbraco.Tests.CodeFirst.Definitions +{ + public static class Conventions + { + /// + /// Convention to get a DataTypeDefinition from the PropertyTypeAttribute or the type of the property itself + /// + /// + /// + /// + public static IDataTypeDefinition DataTypeConvention(PropertyTypeAttribute attribute, Type type) + { + if (attribute != null) + { + var instance = Activator.CreateInstance(attribute.Type); + var dataType = instance as IDataType; + var definition = GetDataTypeByControlId(dataType.Id); + //If the DataTypeDefinition doesn't exist we create a new one + if (definition == null) + { + definition = new DataTypeDefinition(-1, dataType.Id) + { + DatabaseType = attribute.DatabaseType, + Name = dataType.DataTypeName + }; + ServiceFactory.DataTypeService.Save(definition, 0); + } + return definition; + } + + return TypeToPredefinedDataTypeConvention(type); + } + + /// + /// Convention to get predefined DataTypeDefinitions based on the Type of the property + /// + /// + /// + public static IDataTypeDefinition TypeToPredefinedDataTypeConvention(Type type) + { + if (type == typeof(bool)) + { + return GetDataTypeByControlId(new Guid("38b352c1-e9f8-4fd8-9324-9a2eab06d97a"));// Yes/No DataType + } + if (type == typeof(int)) + { + return GetDataTypeByControlId(new Guid("1413afcb-d19a-4173-8e9a-68288d2a73b8"));// Number DataType + } + if (type == typeof(DateTime)) + { + return GetDataTypeByControlId(new Guid("23e93522-3200-44e2-9f29-e61a6fcbb79a"));// Date Picker DataType + } + + return GetDataTypeByControlId(new Guid("ec15c1e5-9d90-422a-aa52-4f7622c63bea"));// Standard textfield + } + + /// + /// Gets the from the DataTypeService by its control Id + /// + /// + /// + public static IDataTypeDefinition GetDataTypeByControlId(Guid id) + { + var definitions = ServiceFactory.DataTypeService.GetDataTypeDefinitionByControlId(id); + return definitions.FirstOrDefault(); + } + + /// + /// Convention to get the Alias of the PropertyType from the AliasAttribute or the property itself + /// + /// + /// + /// + public static string PropertyTypeAliasConvention(AliasAttribute attribute, string propertyName) + { + return attribute == null ? propertyName.ToUmbracoAlias() : attribute.Alias; + } + + /// + /// Convention to get the Name of the PropertyType from the AliasAttribute or the property itself + /// + /// + /// + /// + public static string PropertyTypeNameConvention(AliasAttribute attribute, string propertyName) + { + if (attribute == null) + return propertyName.SplitPascalCasing(); + + return string.IsNullOrEmpty(attribute.Name) ? propertyName.SplitPascalCasing() : attribute.Name; + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/CodeFirst/TestModels/DecoratedModelPage.cs b/src/Umbraco.Tests/CodeFirst/TestModels/DecoratedModelPage.cs index dfd84240ba..cdf808fb2b 100644 --- a/src/Umbraco.Tests/CodeFirst/TestModels/DecoratedModelPage.cs +++ b/src/Umbraco.Tests/CodeFirst/TestModels/DecoratedModelPage.cs @@ -4,18 +4,26 @@ using umbraco.editorControls.textfield; namespace Umbraco.Tests.CodeFirst.TestModels { - [ContentType("modelPage", AllowedChildContentTypes = new[] { typeof(ContentPage) }, AllowedTemplates = new[]{"umbMaster"})] + [ContentType("modelPage", + AllowedChildContentTypes = new[] { typeof(ContentPage) }, + AllowedTemplates = new[]{"umbMaster"})] public class DecoratedModelPage { [PropertyType(typeof(TextFieldDataType), PropertyGroup = "Content")] + [SortOrder(0)] public string Author { get; set; } [PropertyType(typeof(TextFieldDataType), PropertyGroup = "Content")] + [SortOrder(1)] public string Title { get; set; } [Richtext(PropertyGroup = "Content")] + [SortOrder(2)] + [Description("Richtext field to enter the main content of the page")] public string BodyContent { get; set; } + [SortOrder(3)] + [Alias("publishedDate", Name = "Publish Date")] public DateTime PublishDate { get; set; } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/CodeFirst/TestModels/ModelWithNewDataType.cs b/src/Umbraco.Tests/CodeFirst/TestModels/ModelWithNewDataType.cs new file mode 100644 index 0000000000..2b3945b432 --- /dev/null +++ b/src/Umbraco.Tests/CodeFirst/TestModels/ModelWithNewDataType.cs @@ -0,0 +1,15 @@ +using Umbraco.Tests.CodeFirst.Attributes; +using umbraco.editorControls.textfield; +using umbraco.editorControls.tinymce; + +namespace Umbraco.Tests.CodeFirst.TestModels +{ + public class ModelWithNewDataType + { + [PropertyType(typeof(TextFieldDataType), PropertyGroup = "Content")] + public string Title { get; set; } + + [PropertyType(typeof(TinyMCEDataType), PropertyGroup = "Content")] + public string BodyContent { get; set; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs index bbec3ac8af..5f1de8817f 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs @@ -133,7 +133,7 @@ namespace Umbraco.Tests.Persistence.Repositories { DatabaseType = DataTypeDatabaseType.Integer, Name = "AgeDataType", - Creator = new Profile(0, "Administrator") + CreatorId = 0 }; // Act @@ -158,7 +158,7 @@ namespace Umbraco.Tests.Persistence.Repositories { DatabaseType = DataTypeDatabaseType.Integer, Name = "AgeDataType", - Creator = new Profile(0, "Administrator") + CreatorId = 0 }; repository.AddOrUpdate(dataTypeDefinition); unitOfWork.Commit(); @@ -188,7 +188,7 @@ namespace Umbraco.Tests.Persistence.Repositories { DatabaseType = DataTypeDatabaseType.Integer, Name = "AgeDataType", - Creator = new Profile(0, "Administrator") + CreatorId = 0 }; // Act diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 85dc03272f..bde4777197 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -93,17 +93,20 @@ + + +