PublishedContent - align with v7, refactor IPublishedProperty & names

This commit is contained in:
Stephan
2013-09-19 13:09:27 +02:00
parent f9cae9c4d8
commit c3caf7ff04
20 changed files with 80 additions and 77 deletions

View File

@@ -322,14 +322,15 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
if (dd.LoadedFromExamine)
{
//if this is from Examine, lets check if the alias does not exist on the document
if (dd.Properties.All(x => x.Alias != alias))
if (dd.Properties.All(x => x.PropertyTypeAlias != alias))
{
//ok it doesn't exist, we might assume now that Examine didn't index this property because the index is not set up correctly
//so before we go loading this from the database, we can check if the alias exists on the content type at all, this information
//is cached so will be quicker to look up.
if (dd.Properties.Any(x => x.Alias == UmbracoContentIndexer.NodeTypeAliasFieldName))
if (dd.Properties.Any(x => x.PropertyTypeAlias == UmbracoContentIndexer.NodeTypeAliasFieldName))
{
var aliasesAndNames = ContentType.GetAliasesAndNames(dd.Properties.First(x => x.Alias.InvariantEquals(UmbracoContentIndexer.NodeTypeAliasFieldName)).RawValue.ToString());
// fixme - is it OK to use DataValue here?
var aliasesAndNames = ContentType.GetAliasesAndNames(dd.Properties.First(x => x.PropertyTypeAlias.InvariantEquals(UmbracoContentIndexer.NodeTypeAliasFieldName)).DataValue.ToString());
if (aliasesAndNames != null)
{
if (!aliasesAndNames.ContainsKey(alias))
@@ -346,7 +347,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
{
media.MoveNext();
var mediaDoc = ConvertFromXPathNavigator(media.Current);
return mediaDoc.Properties.FirstOrDefault(x => x.Alias.InvariantEquals(alias));
return mediaDoc.Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias));
}
}
}
@@ -354,9 +355,9 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
//We've made it here which means that the value is stored in the Examine index.
//We are going to check for a special field however, that is because in some cases we store a 'Raw'
//value in the index such as for xml/html.
var rawValue = dd.Properties.FirstOrDefault(x => x.Alias.InvariantEquals(UmbracoContentIndexer.RawFieldPrefix + alias));
var rawValue = dd.Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(UmbracoContentIndexer.RawFieldPrefix + alias));
return rawValue
?? dd.Properties.FirstOrDefault(x => x.Alias.InvariantEquals(alias));
?? dd.Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias));
}
/// <summary>

View File

@@ -98,7 +98,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
public override IPublishedProperty GetProperty(string alias)
{
return Properties.FirstOrDefault(x => x.Alias.InvariantEquals(alias));
return Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias));
}
// override to implement cache

View File

@@ -18,14 +18,14 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
{
private readonly string _xmlValue; // the raw, xml node value
private readonly Lazy<object> _sourceValue;
private readonly Lazy<object> _value;
private readonly Lazy<object> _objectValue;
private readonly Lazy<object> _xpathValue;
private readonly bool _isPreviewing;
/// <summary>
/// Gets the raw value of the property.
/// </summary>
public override object RawValue { get { return _xmlValue; } }
public override object DataValue { get { return _xmlValue; } }
// in the Xml cache, everything is a string, and to have a value
// you want to have a non-null, non-empty string.
@@ -34,7 +34,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
get { return _xmlValue.Trim().Length > 0; }
}
public override object Value { get { return _value.Value; } }
public override object ObjectValue { get { return _objectValue.Value; } }
public override object XPathValue { get { return _xpathValue.Value; } }
public XmlPublishedProperty(PublishedPropertyType propertyType, bool isPreviewing, XmlNode propertyXmlData)
@@ -60,7 +60,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
_isPreviewing = isPreviewing;
_sourceValue = new Lazy<object>(() => PropertyType.ConvertDataToSource(_xmlValue, _isPreviewing));
_value = new Lazy<object>(() => PropertyType.ConvertSourceToObject(_sourceValue.Value, _isPreviewing));
_objectValue = new Lazy<object>(() => PropertyType.ConvertSourceToObject(_sourceValue.Value, _isPreviewing));
_xpathValue = new Lazy<object>(() => PropertyType.ConvertSourceToXPath(_sourceValue.Value, _isPreviewing));
}
}