diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs index 3ff274a596..587d88481b 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs @@ -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); } diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs index e6f180e63c..1c8b344298 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs @@ -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(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