Fix UmbracoObjectTypes enum bkwd compatibility issue

This commit is contained in:
Stephan
2017-08-01 15:51:04 +02:00
parent 6655be5f5e
commit 5fab5102d9
2 changed files with 13 additions and 14 deletions

View File

@@ -38,14 +38,6 @@ namespace Umbraco.Core.Models
[UmbracoUdiType(Constants.UdiEntityType.Document)]
Document,
/// <summary>
/// Document
/// </summary>
[UmbracoObjectType(Constants.ObjectTypes.DocumentBlueprint, typeof(IContent))]
[FriendlyName("DocumentBlueprint")]
[UmbracoUdiType(Constants.UdiEntityType.DocumentBluePrint)]
DocumentBlueprint,
/// <summary>
/// Media
/// </summary>
@@ -193,6 +185,14 @@ namespace Umbraco.Core.Models
/// </summary>
[UmbracoObjectType(Constants.ObjectTypes.Language)]
[FriendlyName("Language")]
Language
Language,
/// <summary>
/// Document
/// </summary>
[UmbracoObjectType(Constants.ObjectTypes.DocumentBlueprint, typeof(IContent))]
[FriendlyName("DocumentBlueprint")]
[UmbracoUdiType(Constants.UdiEntityType.DocumentBluePrint)]
DocumentBlueprint
}
}

View File

@@ -68,15 +68,14 @@ namespace Umbraco.Core.Models
{
return UmbracoObjectTypeCache.GetOrAdd(umbracoObjectType, types =>
{
var type = typeof(UmbracoObjectTypes);
var memInfo = type.GetMember(umbracoObjectType.ToString());
var attributes = memInfo[0].GetCustomAttributes(typeof(UmbracoObjectTypeAttribute),
false);
var type = typeof (UmbracoObjectTypes);
var memberInfo = type.GetMember(umbracoObjectType.ToString());
var attributes = memberInfo[0].GetCustomAttributes(typeof (UmbracoObjectTypeAttribute), false);
if (attributes.Length == 0)
return Guid.Empty;
var attribute = ((UmbracoObjectTypeAttribute)attributes[0]);
var attribute = (UmbracoObjectTypeAttribute) attributes[0];
if (attribute == null)
return Guid.Empty;