Fix build after merge

This commit is contained in:
Stephan
2013-09-24 09:12:58 +02:00
parent 3ca8b356ee
commit bcfb562dde
24 changed files with 105 additions and 231 deletions

View File

@@ -74,14 +74,6 @@ namespace Umbraco.Core
{
}
internal void ClearStaticCacheObjectTypes<T>(Func<string, T, bool> predicate)
{
if (_enableCache)
_staticCache.ClearCacheObjectTypes(predicate);
else
_nullStaticCache.ClearCacheObjectTypes(predicate);
}
/// <summary>
/// Private ctor used for creating a disabled cache helper
/// </summary>

View File

@@ -102,7 +102,7 @@ namespace Umbraco.Core.Models.PublishedContent
Logging.LogHelper.Debug<PublishedContentType>("Clear all.");
// ok and faster to do it by types, assuming noone else caches PublishedContentType instances
//ApplicationContext.Current.ApplicationCache.ClearStaticCacheByKeySearch("PublishedContentType_");
ApplicationContext.Current.ApplicationCache.ClearStaticCacheObjectTypes<PublishedContentType>();
ApplicationContext.Current.ApplicationCache.StaticCache.ClearCacheObjectTypes<PublishedContentType>();
}
internal static void ClearContentType(int id)
@@ -110,7 +110,7 @@ namespace Umbraco.Core.Models.PublishedContent
Logging.LogHelper.Debug<PublishedContentType>("Clear content type w/id {0}.", () => id);
// requires a predicate because the key does not contain the ID
// faster than key strings comparisons anyway
ApplicationContext.Current.ApplicationCache.ClearStaticCacheObjectTypes<PublishedContentType>(
ApplicationContext.Current.ApplicationCache.StaticCache.ClearCacheObjectTypes<PublishedContentType>(
(key, value) => value.Id == id);
}
@@ -121,7 +121,7 @@ namespace Umbraco.Core.Models.PublishedContent
// properties ie both its own properties and those that were inherited (it's based upon an
// IContentTypeComposition) and so every PublishedContentType having a property based upon
// the cleared data type, be it local or inherited, will be cleared.
ApplicationContext.Current.ApplicationCache.ClearStaticCacheObjectTypes<PublishedContentType>(
ApplicationContext.Current.ApplicationCache.StaticCache.ClearCacheObjectTypes<PublishedContentType>( // fixme NOT!
(key, value) => value.PropertyTypes.Any(x => x.DataTypeId == id));
}
@@ -130,7 +130,7 @@ namespace Umbraco.Core.Models.PublishedContent
var key = string.Format("PublishedContentType_{0}_{1}",
itemType == PublishedItemType.Content ? "content" : "media", alias.ToLowerInvariant());
var type = ApplicationContext.Current.ApplicationCache.GetStaticCacheItem(key,
var type = ApplicationContext.Current.ApplicationCache.StaticCache.GetCacheItem<PublishedContentType>(key,
() => CreatePublishedContentType(itemType, alias));
return type;
@@ -157,7 +157,7 @@ namespace Umbraco.Core.Models.PublishedContent
{
// see note above
//ClearAll();
ApplicationContext.Current.ApplicationCache.ClearStaticCacheByKeySearch("PublishedContentType_");
ApplicationContext.Current.ApplicationCache.StaticCache.ClearCacheByKeySearch("PublishedContentType_");
_getPublishedContentTypeCallBack = value;
}

View File

@@ -24,22 +24,19 @@ namespace Umbraco.Core.Models.PublishedContent
PropertyTypeAlias = propertyType.Alias;
DataTypeId = propertyType.DataTypeDefinitionId;
PropertyEditorGuid = propertyType.DataTypeId;
//PropertyEditorAlias = propertyType.PropertyEditorAlias;
PropertyEditorAlias = propertyType.PropertyEditorAlias;
InitializeConverters();
}
// for unit tests
internal PublishedPropertyType(string propertyTypeAlias, int dataTypeDefinitionId, Guid propertyEditorGuid)
//internal PublishedPropertyType(string propertyTypeAlias, int dataTypeDefinitionId, Alias propertyEditorAlias)
internal PublishedPropertyType(string propertyTypeAlias, int dataTypeDefinitionId, string propertyEditorAlias)
{
// ContentType to be set by PublishedContentType when creating it
PropertyTypeAlias = propertyTypeAlias;
DataTypeId = dataTypeDefinitionId;
PropertyEditorGuid = propertyEditorGuid;
//PropertyEditorAlias = PropertyEditorAlias;
PropertyEditorAlias = PropertyEditorAlias;
InitializeConverters();
}
@@ -62,15 +59,10 @@ namespace Umbraco.Core.Models.PublishedContent
/// </summary>
public int DataTypeId { get; private set; }
/// <summary>
/// Gets or sets the guid uniquely identifying the property editor for the property type.
/// </summary>
public Guid PropertyEditorGuid { get; private set; }
/// <summary>
/// Gets or sets the alias uniquely identifying the property editor for the property type.
/// </summary>
//public string PropertyEditorAlias { get; private set; }
public string PropertyEditorAlias { get; private set; }
#endregion
@@ -211,9 +203,10 @@ namespace Umbraco.Core.Models.PublishedContent
IEnumerable<IPropertyValueConverter> GetCompatConverters()
{
return PropertyEditorValueConvertersResolver.HasCurrent
var propertyEditorGuid = LegacyPropertyEditorIdToAliasConverter.GetLegacyIdFromAlias(PropertyEditorAlias);
return PropertyEditorValueConvertersResolver.HasCurrent && propertyEditorGuid.HasValue
? PropertyEditorValueConvertersResolver.Current.Converters
.Where(x => x.IsConverterFor(PropertyEditorGuid, ContentType.Alias, PropertyTypeAlias))
.Where(x => x.IsConverterFor(propertyEditorGuid.Value, ContentType.Alias, PropertyTypeAlias))
.Select(x => new CompatConverter(x))
: Enumerable.Empty<IPropertyValueConverter>();
}

View File

@@ -1,23 +0,0 @@
namespace Umbraco.Core.Models
{
/// <summary>
/// The definition of a published property
/// </summary>
public class PublishedPropertyDefinition
{
public PublishedPropertyDefinition(string propertyTypeAlias, string documentTypeAlias, string propertyEditorAlias)
{
//PropertyId = propertyId;
DocumentTypeAlias = documentTypeAlias;
PropertyTypeAlias = propertyTypeAlias;
PropertyEditorAlias = propertyEditorAlias;
//ItemType = itemType;
}
//public int PropertyId { get; private set; }
public string DocumentTypeAlias { get; private set; }
public string PropertyTypeAlias { get; private set; }
public string PropertyEditorAlias { get; private set; }
//public PublishedItemType ItemType { get; private set; }
}
}

View File

@@ -488,7 +488,7 @@ namespace Umbraco.Core
/// <returns></returns>
internal IEnumerable<Type> ResolvePropertyValueConverters()
{
return ResolveTypes<PropertyValueConverter>();
return ResolveTypes<IPropertyValueConverter>();
}
/// <summary>

View File

@@ -1,26 +0,0 @@
using System;
using System.Linq;
using Umbraco.Core.Models;
namespace Umbraco.Core.PropertyEditors
{
internal class DatePickerPropertyValueConverter : PropertyValueConverter
{
public override string AssociatedPropertyEditorAlias
{
get { return Constants.PropertyEditors.DateAlias; }
}
/// <summary>
/// return a DateTime object even if the value is a string
/// </summary>
/// <param name="valueToConvert"></param>
/// <param name="propertyDefinition"></param>
/// <param name="isPreviewing"></param>
/// <returns></returns>
public override Attempt<object> ConvertSourceToObject(object valueToConvert, PublishedPropertyDefinition propertyDefinition, bool isPreviewing)
{
return valueToConvert.TryConvertTo(typeof(DateTime));
}
}
}

View File

@@ -1,25 +0,0 @@
using System;
using Umbraco.Core.Models;
namespace Umbraco.Core.PropertyEditors
{
internal class DateTimePickerPropertyValueConverter : PropertyValueConverter
{
public override string AssociatedPropertyEditorAlias
{
get { return Constants.PropertyEditors.DateTimeAlias; }
}
/// <summary>
/// return a DateTime object even if the value is a string
/// </summary>
/// <param name="valueToConvert"></param>
/// <param name="propertyDefinition"></param>
/// <param name="isPreviewing"></param>
/// <returns></returns>
public override Attempt<object> ConvertSourceToObject(object valueToConvert, PublishedPropertyDefinition propertyDefinition, bool isPreviewing)
{
return valueToConvert.TryConvertTo(typeof(DateTime));
}
}
}

View File

@@ -1,17 +1,18 @@
using Umbraco.Core.Models;
namespace Umbraco.Core.PropertyEditors
{
/// <summary>
/// Used to convert property values from various sources to various destination formats for use with caching
/// </summary>
public abstract class PropertyValueConverter
{
/// <summary>
/// Returns the alias of the PropertyEditor that this converter is for
/// </summary>
public abstract string AssociatedPropertyEditorAlias { get; }
// fixme - delete file
//namespace Umbraco.Core.PropertyEditors
//{
// /// <summary>
// /// Used to convert property values from various sources to various destination formats for use with caching
// /// </summary>
// public abstract class PropertyValueConverter
// {
// /// <summary>
// /// Returns the alias of the PropertyEditor that this converter is for
// /// </summary>
// public abstract string AssociatedPropertyEditorAlias { get; }
public abstract Attempt<object> ConvertSourceToObject(object valueToConvert, PublishedPropertyDefinition propertyDefinition, bool isPreviewing);
}
}
// public abstract Attempt<object> ConvertSourceToObject(object valueToConvert, PublishedPropertyDefinition propertyDefinition, bool isPreviewing);
// }
//}

View File

@@ -1,22 +0,0 @@
using System;
using System.Web;
using Umbraco.Core.Models;
namespace Umbraco.Core.PropertyEditors
{
/// <summary>
/// Value converter for the RTE so that it always returns IHtmlString so that Html.Raw doesn't have to be used.
/// </summary>
internal class TinyMcePropertyValueConverter : PropertyValueConverter
{
public override string AssociatedPropertyEditorAlias
{
get { return Constants.PropertyEditors.TinyMCEv3Alias; }
}
public override Attempt<object> ConvertSourceToObject(object valueToConvert, PublishedPropertyDefinition propertyDefinition, bool isPreviewing)
{
return new Attempt<object>(true, new HtmlString(valueToConvert.ToString()));
}
}
}

View File

@@ -10,15 +10,15 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
[PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)]
public class DatePickerValueConverter : PropertyValueConverterBase
{
private static readonly Guid[] DataTypeGuids = new[]
{
Guid.Parse(Constants.PropertyEditors.DateTime),
Guid.Parse(Constants.PropertyEditors.Date)
};
private static readonly string[] PropertyEditorAliases =
{
Constants.PropertyEditors.DateTimeAlias,
Constants.PropertyEditors.DateAlias
};
public override bool IsConverter(PublishedPropertyType propertyType)
{
return DataTypeGuids.Contains(propertyType.PropertyEditorGuid);
return PropertyEditorAliases.Contains(propertyType.PropertyEditorAlias);
}
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)

View File

@@ -14,7 +14,7 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
{
public override bool IsConverter(PublishedPropertyType propertyType)
{
return Guid.Parse(Constants.PropertyEditors.TinyMCEv3).Equals(propertyType.PropertyEditorGuid);
return propertyType.PropertyEditorAlias == Constants.PropertyEditors.TinyMCEv3Alias;
}
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)

View File

@@ -9,7 +9,7 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
{
public override bool IsConverter(PublishedPropertyType propertyType)
{
return Guid.Parse(Constants.PropertyEditors.TrueFalse).Equals(propertyType.PropertyEditorGuid);
return propertyType.PropertyEditorAlias == Constants.PropertyEditors.TrueFalseAlias;
}
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)

View File

@@ -1,25 +0,0 @@
using System;
using Umbraco.Core.Models;
namespace Umbraco.Core.PropertyEditors
{
internal class YesNoPropertyValueConverter : PropertyValueConverter
{
public override string AssociatedPropertyEditorAlias
{
get { return Constants.PropertyEditors.TrueFalseAlias; }
}
/// <summary>
/// Convert from string boolean or 0 or 1 to real boolean
/// </summary>
/// <param name="valueToConvert"></param>
/// <param name="propertyDefinition"></param>
/// <param name="isPreviewing"></param>
/// <returns></returns>
public override Attempt<object> ConvertSourceToObject(object valueToConvert, PublishedPropertyDefinition propertyDefinition, bool isPreviewing)
{
return valueToConvert.TryConvertTo(typeof(bool));
}
}
}

View File

@@ -308,7 +308,6 @@
<Compile Include="PropertyEditors\PropertyCacheLevel.cs" />
<Compile Include="PropertyEditors\PropertyValueConverterBase.cs" />
<Compile Include="PropertyEditors\ValueConverters\TinyMceValueConverter.cs" />
<Compile Include="PropertyEditors\PropertyValueConvertersResolver.cs" />
<Compile Include="PropertyEditors\IPropertyValueConverter.cs" />
<Compile Include="Models\PublishedContent\PublishedContentOrderedSet.cs" />
<Compile Include="Models\PublishedContent\PublishedContentSet.cs" />
@@ -358,7 +357,6 @@
<Compile Include="Models\PreValue.cs" />
<Compile Include="Models\MemberType.cs" />
<Compile Include="Models\PreValueCollection.cs" />
<Compile Include="Models\PublishedPropertyDefinition.cs" />
<Compile Include="Models\Rdbms\MemberReadOnlyDto.cs" />
<Compile Include="Models\Rdbms\MemberTypeReadOnlyDto.cs" />
<Compile Include="Models\Rdbms\PropertyDataReadOnlyDto.cs" />
@@ -733,7 +731,6 @@
<Compile Include="Profiling\ProfilerExtensions.cs" />
<Compile Include="Profiling\ProfilerResolver.cs" />
<Compile Include="Profiling\WebProfiler.cs" />
<Compile Include="PropertyEditors\DateTimePickerPropertyValueConverter.cs" />
<Compile Include="PropertyEditors\DelimitedManifestValueValidator.cs" />
<Compile Include="PropertyEditors\IntegerValidator.cs" />
<Compile Include="PropertyEditors\ManifestPropertyValidator.cs" />

View File

@@ -74,12 +74,12 @@ namespace Umbraco.Tests.CodeFirst
var propertyTypes = new[]
{
// AutoPublishedContentType will auto-generate other properties
new PublishedPropertyType("siteDescription", 0, Guid.Empty),
new PublishedPropertyType("siteName", 0, Guid.Empty),
new PublishedPropertyType("articleContent", 0, Guid.Empty),
new PublishedPropertyType("articleAuthor", 0, Guid.Empty),
new PublishedPropertyType("articleDate", 0, Guid.Empty),
new PublishedPropertyType("pageTitle", 0, Guid.Empty),
new PublishedPropertyType("siteDescription", 0, "?"),
new PublishedPropertyType("siteName", 0, "?"),
new PublishedPropertyType("articleContent", 0, "?"),
new PublishedPropertyType("articleAuthor", 0, "?"),
new PublishedPropertyType("articleDate", 0, "?"),
new PublishedPropertyType("pageTitle", 0, "?"),
};
var type = new AutoPublishedContentType(0, "anything", propertyTypes);
PublishedContentType.GetPublishedContentTypeCallback = (alias) => type;

View File

@@ -39,7 +39,7 @@ namespace Umbraco.Tests
var propertyTypes = new[]
{
// AutoPublishedContentType will auto-generate other properties
new PublishedPropertyType("content", 0, Guid.Empty),
new PublishedPropertyType("content", 0, "?"),
};
var type = new AutoPublishedContentType(0, "anything", propertyTypes);
PublishedContentType.GetPublishedContentTypeCallback = (alias) => type;

View File

@@ -114,12 +114,6 @@ namespace Umbraco.Tests.PublishedCache
base.FreezeResolution();
}
[TearDown]
public void TearDown()
{
UmbracoSettings.Reset();
}
[Test]
public void Has_Content_LegacySchema()
{

View File

@@ -17,15 +17,6 @@ namespace Umbraco.Tests.PublishedContent
[TestFixture]
public abstract class DynamicDocumentTestsBase<TDocument, TDocumentList> : PublishedContentTestBase
{
public override void Initialize()
{
base.Initialize();
var scriptingMock = Mock.Get(UmbracoSettings.Scripting);
scriptingMock.Setup(x => x.DataTypeModelStaticMappings).Returns(new List<IRazorStaticMapping>());
}
protected override DatabaseBehavior DatabaseTestBehavior
{
get { return DatabaseBehavior.NoDatabasePerFixture; }
@@ -38,6 +29,9 @@ namespace Umbraco.Tests.PublishedContent
base.Initialize();
var scriptingMock = Mock.Get(UmbracoSettings.Scripting);
scriptingMock.Setup(x => x.DataTypeModelStaticMappings).Returns(new List<IRazorStaticMapping>());
// need to specify a custom callback for unit tests
// AutoPublishedContentTypes generates properties automatically
// when they are requested, but we must declare those that we
@@ -46,14 +40,14 @@ namespace Umbraco.Tests.PublishedContent
var propertyTypes = new[]
{
// AutoPublishedContentType will auto-generate other properties
new PublishedPropertyType("umbracoNaviHide", 0, Guid.Empty),
new PublishedPropertyType("selectedNodes", 0, Guid.Empty),
new PublishedPropertyType("umbracoUrlAlias", 0, Guid.Empty),
new PublishedPropertyType("content", 0, Guid.Parse(Constants.PropertyEditors.TinyMCEv3)),
new PublishedPropertyType("testRecursive", 0, Guid.Empty),
new PublishedPropertyType("siteTitle", 0, Guid.Empty),
new PublishedPropertyType("creatorName", 0, Guid.Empty),
new PublishedPropertyType("blah", 0, Guid.Empty), // ugly error when that one is missing...
new PublishedPropertyType("umbracoNaviHide", 0, "?"),
new PublishedPropertyType("selectedNodes", 0, "?"),
new PublishedPropertyType("umbracoUrlAlias", 0, "?"),
new PublishedPropertyType("content", 0, Constants.PropertyEditors.TinyMCEv3Alias),
new PublishedPropertyType("testRecursive", 0, "?"),
new PublishedPropertyType("siteTitle", 0, "?"),
new PublishedPropertyType("creatorName", 0, "?"),
new PublishedPropertyType("blah", 0, "?"), // ugly error when that one is missing...
};
var type = new AutoPublishedContentType(0, "anything", propertyTypes);
PublishedContentType.GetPublishedContentTypeCallback = (alias) => type;

View File

@@ -1,5 +1,6 @@
using System.Linq;
using System.Collections.ObjectModel;
using System.Web.Routing;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Models;
@@ -9,21 +10,29 @@ using Umbraco.Core.PropertyEditors;
using Umbraco.Web;
using Umbraco.Tests.TestHelpers;
using umbraco.BusinessLogic;
using Umbraco.Web.PublishedCache.XmlPublishedCache;
using Umbraco.Web.Security;
namespace Umbraco.Tests.PublishedContent
{
[TestFixture]
public class PublishedContentMoreTests
public class PublishedContentMoreTests : PublishedContentTestBase
{
protected override DatabaseBehavior DatabaseTestBehavior
{
get { return DatabaseBehavior.NoDatabasePerFixture; }
}
// read http://stackoverflow.com/questions/7713326/extension-method-that-works-on-ienumerablet-and-iqueryablet
// and http://msmvps.com/blogs/jon_skeet/archive/2010/10/28/overloading-and-generic-constraints.aspx
// and http://blogs.msdn.com/b/ericlippert/archive/2009/12/10/constraints-are-not-part-of-the-signature.aspx
private PluginManager _pluginManager;
[SetUp]
public void Setup()
public override void Initialize()
{
base.Initialize();
// this is so the model factory looks into the test assembly
_pluginManager = PluginManager.Current;
PluginManager.Current = new PluginManager(false)
@@ -38,20 +47,36 @@ namespace Umbraco.Tests.PublishedContent
new PublishedContentModelFactoryResolver(new PublishedContentModelFactoryImpl());
Resolution.Freeze();
//var caches = CreatePublishedContent();
//var factory = new FakeHttpContextFactory("http://umbraco.local/");
//StateHelper.HttpContext = factory.HttpContext;
//var context = new UmbracoContext(
// factory.HttpContext,
// ApplicationContext.Current,
// caches);
//UmbracoContext.Current = context;
InitializeUmbracoContext();
}
private void InitializeUmbracoContext()
{
RouteData routeData = null;
var caches = CreatePublishedContent();
ApplicationContext.Current = new ApplicationContext(false) { IsReady = true };
var factory = new FakeHttpContextFactory("http://umbraco.local/");
StateHelper.HttpContext = factory.HttpContext;
var context = new UmbracoContext(
factory.HttpContext,
ApplicationContext.Current,
caches);
UmbracoContext.Current = context;
var httpContext = GetHttpContextFactory("http://umbraco.local/", routeData).HttpContext;
var ctx = new UmbracoContext(
httpContext,
ApplicationContext,
caches,
new WebSecurity(httpContext, ApplicationContext));
UmbracoContext.Current = ctx;
}
[TearDown]
public void TearDown()
public override void TearDown()
{
PluginManager.Current = _pluginManager;
ApplicationContext.Current.DisposeIfDisposable();
@@ -204,7 +229,7 @@ namespace Umbraco.Tests.PublishedContent
var props = new[]
{
new PublishedPropertyType("prop1", 1, System.Guid.Empty),
new PublishedPropertyType("prop1", 1, "?"),
};
var contentType1 = new PublishedContentType(1, "ContentType1", props);

View File

@@ -27,7 +27,7 @@ namespace Umbraco.Tests.PublishedContent
var propertyTypes = new[]
{
// AutoPublishedContentType will auto-generate other properties
new PublishedPropertyType("content", 0, Guid.Parse(Constants.PropertyEditors.TinyMCEv3)),
new PublishedPropertyType("content", 0, Constants.PropertyEditors.TinyMCEv3Alias),
};
var type = new AutoPublishedContentType(0, "anything", propertyTypes);
PublishedContentType.GetPublishedContentTypeCallback = (alias) => type;

View File

@@ -286,7 +286,7 @@ namespace Umbraco.Tests.PublishedContent
class AutoPublishedContentType : PublishedContentType
{
private static readonly PublishedPropertyType Default = new PublishedPropertyType("*", 0, Guid.Empty);
private static readonly PublishedPropertyType Default = new PublishedPropertyType("*", 0, "?");
public AutoPublishedContentType(int id, string alias, IEnumerable<PublishedPropertyType> propertyTypes)
: base(id, alias, propertyTypes)

View File

@@ -40,8 +40,6 @@ namespace Umbraco.Tests.PublishedContent
.Union(new[] { typeof(PublishedContentTests).Assembly })
};
ApplicationContext.Current = new ApplicationContext(false) { IsReady = true };
// need to specify a custom callback for unit tests
// AutoPublishedContentTypes generates properties automatically
// when they are requested, but we must declare those that we
@@ -50,11 +48,11 @@ namespace Umbraco.Tests.PublishedContent
var propertyTypes = new[]
{
// AutoPublishedContentType will auto-generate other properties
new PublishedPropertyType("umbracoNaviHide", 0, Guid.Parse(Constants.PropertyEditors.TrueFalse)),
new PublishedPropertyType("selectedNodes", 0, Guid.Empty),
new PublishedPropertyType("umbracoUrlAlias", 0, Guid.Empty),
new PublishedPropertyType("content", 0, Guid.Parse(Constants.PropertyEditors.TinyMCEv3)),
new PublishedPropertyType("testRecursive", 0, Guid.Empty),
new PublishedPropertyType("umbracoNaviHide", 0, Constants.PropertyEditors.TrueFalseAlias),
new PublishedPropertyType("selectedNodes", 0, "?"),
new PublishedPropertyType("umbracoUrlAlias", 0, "?"),
new PublishedPropertyType("content", 0, Constants.PropertyEditors.TinyMCEv3Alias),
new PublishedPropertyType("testRecursive", 0, "?"),
};
var type = new AutoPublishedContentType(0, "anything", propertyTypes);
PublishedContentType.GetPublishedContentTypeCallback = (alias) => type;

View File

@@ -374,7 +374,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
if (_xmlNode.Attributes.GetNamedItem("writerID") != null)
_writerId = int.Parse(_xmlNode.Attributes.GetNamedItem("writerID").Value);
if (UmbracoSettings.UseLegacyXmlSchema)
if (UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema)
{
if (_xmlNode.Attributes.GetNamedItem("nodeTypeAlias") != null)
_docTypeAlias = _xmlNode.Attributes.GetNamedItem("nodeTypeAlias").Value;
@@ -401,7 +401,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
}
// load data
var dataXPath = UmbracoSettings.UseLegacyXmlSchema ? "data" : "* [not(@isDoc)]";
var dataXPath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "data" : "* [not(@isDoc)]";
var nodes = _xmlNode.SelectNodes(dataXPath);
_contentType = PublishedContentType.Get(PublishedItemType.Content, _docTypeAlias);
@@ -410,7 +410,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
if (nodes != null)
foreach (XmlNode n in nodes)
{
var alias = UmbracoSettings.UseLegacyXmlSchema
var alias = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema
? n.Attributes.GetNamedItem("alias").Value
: n.Name;
propertyNodes[alias.ToLowerInvariant()] = n;
@@ -433,7 +433,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
if (_xmlNode == null) return;
// load children
var childXPath = UmbracoSettings.UseLegacyXmlSchema ? "node" : "* [@isDoc]";
var childXPath = UmbracoConfiguration.Current.UmbracoSettings.Content.UseLegacyXmlSchema ? "node" : "* [@isDoc]";
var nav = _xmlNode.CreateNavigator();
var expr = nav.Compile(childXPath);
expr.AddSort("@sortOrder", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Number);

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Net.Security;