From 65d7e04049bb6b42270c5d89549788cc45db5cad Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 7 Aug 2013 10:34:51 +1000 Subject: [PATCH] fix up merge errors --- src/Umbraco.Core/Models/PropertyExtensions.cs | 25 ++++++++----------- .../TestHelpers/BaseDatabaseFactoryTest.cs | 9 ++++--- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Umbraco.Core/Models/PropertyExtensions.cs b/src/Umbraco.Core/Models/PropertyExtensions.cs index 8fb94e8c0c..d5a9ce8ac9 100644 --- a/src/Umbraco.Core/Models/PropertyExtensions.cs +++ b/src/Umbraco.Core/Models/PropertyExtensions.cs @@ -3,6 +3,8 @@ using System.Xml; using System.Xml.Linq; using Umbraco.Core.Configuration; using Umbraco.Core.PropertyEditors; +using Umbraco.Core.Services; +using umbraco.interfaces; namespace Umbraco.Core.Models { @@ -39,19 +41,6 @@ namespace Umbraco.Core.Models // XML construct from the value returned from the Property Editor. // More details discussed here: https://groups.google.com/forum/?fromgroups=#!topic/umbraco-dev/fieWZzHj7oY - //var dataType = ApplicationContext.Current.Services.DataTypeService.GetDataTypeDefinitionById(property.PropertyType.DataTypeDefinitionId); - //if (dataType == null) throw new InvalidOperationException("No data type definition found with id " + property.PropertyType.DataTypeDefinitionId); - - //We've already got the value for the property so we're going to give it to the - // data type's data property so it doesn't go re-look up the value from the db again. - var defaultData = dt.Data as IDataValueSetter; - if (defaultData != null) - { - defaultData.SetValue(property.Value, property.PropertyType.DataTypeDatabaseType.ToString()); - } - - xmlNode.AppendChild(dt.Data.ToXMl(xd)); - var propertyEditor = PropertyEditorResolver.Current.GetById(property.PropertyType.DataTypeId); if (propertyEditor != null) { @@ -86,7 +75,15 @@ namespace Umbraco.Core.Models else { //NOTE: An exception will be thrown if this doesn't exist - var legacyDataType = property.PropertyType.DataType(property.Id); + var legacyDataType = property.PropertyType.DataType(property.Id, ApplicationContext.Current.Services.DataTypeService); + + //We've already got the value for the property so we're going to give it to the + // data type's data property so it doesn't go re-look up the value from the db again. + var defaultData = legacyDataType.Data as IDataValueSetter; + if (defaultData != null) + { + defaultData.SetValue(property.Value, property.PropertyType.DataTypeDatabaseType.ToString()); + } xmlNode.AppendChild(legacyDataType.Data.ToXMl(xd)); } diff --git a/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs b/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs index dd75809a5f..9e653d7d29 100644 --- a/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs +++ b/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs @@ -57,17 +57,20 @@ namespace Umbraco.Tests.TestHelpers var path = TestHelper.CurrentAssemblyDirectory; AppDomain.CurrentDomain.SetData("DataDirectory", path); + + //disable cache + var cacheHelper = new CacheHelper(new NullCacheProvider(), false); var dbFactory = new DefaultDatabaseFactory( GetDbConnectionString(), GetDbProviderName()); + _appContext = new ApplicationContext( //assign the db context new DatabaseContext(dbFactory), //assign the service context - new ServiceContext(new PetaPocoUnitOfWorkProvider(dbFactory), new FileUnitOfWorkProvider(), new PublishingStrategy()), - //disable cache - false) + new ServiceContext(new PetaPocoUnitOfWorkProvider(dbFactory), new FileUnitOfWorkProvider(), new PublishingStrategy(), cacheHelper), + cacheHelper) { IsReady = true };