Merge remote-tracking branch 'origin/6.2.0' into 7.0.0

This commit is contained in:
Shannon
2013-11-01 09:07:04 +11:00
2 changed files with 16 additions and 0 deletions

View File

@@ -145,6 +145,10 @@ namespace Umbraco.Core.Models.PublishedContent
? (IContentTypeComposition) ApplicationContext.Current.Services.ContentTypeService.GetContentType(alias)
: (IContentTypeComposition) ApplicationContext.Current.Services.ContentTypeService.GetMediaType(alias);
if (contentType == null)
throw new Exception(string.Format("ContentTypeService failed to find a {0} type with alias \"{1}\".",
itemType.ToString().ToLower(), alias));
return new PublishedContentType(contentType);
}

View File

@@ -76,6 +76,8 @@ namespace Umbraco.Core.Models.PublishedContent
private PropertyCacheLevel _objectCacheLevel;
private PropertyCacheLevel _xpathCacheLevel;
private Type _clrType = typeof (object);
private void InitializeConverters()
{
var converters = PropertyValueConvertersResolver.Current.Converters.ToArray();
@@ -101,6 +103,13 @@ namespace Umbraco.Core.Models.PublishedContent
_objectCacheLevel = GetCacheLevel(_converter, PropertyCacheValue.XPath);
if (_objectCacheLevel < _sourceCacheLevel) _objectCacheLevel = _sourceCacheLevel;
if (_xpathCacheLevel < _sourceCacheLevel) _xpathCacheLevel = _sourceCacheLevel;
if (_converter != null)
{
var attr = _converter.GetType().GetCustomAttribute<PropertyValueTypeAttribute>(false);
if (attr != null)
_clrType = attr.Type;
}
}
static PropertyCacheLevel GetCacheLevel(IPropertyValueConverter converter, PropertyCacheValue value)
@@ -198,6 +207,9 @@ namespace Umbraco.Core.Models.PublishedContent
return source;
}
// gets the property CLR type
public Type ClrType { get { return _clrType; } }
#endregion
#region Compat