|
|
|
@ -1,4 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Immutable; |
|
|
|
using JetBrains.Annotations; |
|
|
|
using Volo.Abp.Data; |
|
|
|
|
|
|
|
@ -80,6 +82,16 @@ namespace Volo.Abp.ObjectExtending |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public static ObjectExtensionPropertyInfo GetPropertyOrNull<TObject>( |
|
|
|
[NotNull] this ObjectExtensionManager objectExtensionManager, |
|
|
|
[NotNull] string propertyName) |
|
|
|
{ |
|
|
|
return objectExtensionManager.GetPropertyOrNull( |
|
|
|
typeof(TObject), |
|
|
|
propertyName |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public static ObjectExtensionPropertyInfo GetPropertyOrNull( |
|
|
|
[NotNull] this ObjectExtensionManager objectExtensionManager, |
|
|
|
[NotNull] Type objectType, |
|
|
|
@ -93,5 +105,26 @@ namespace Volo.Abp.ObjectExtending |
|
|
|
.GetOrNull(objectType)? |
|
|
|
.GetPropertyOrNull(propertyName); |
|
|
|
} |
|
|
|
|
|
|
|
private static readonly ImmutableList<ObjectExtensionPropertyInfo> EmptyPropertyList |
|
|
|
= new List<ObjectExtensionPropertyInfo>().ToImmutableList(); |
|
|
|
|
|
|
|
public static ImmutableList<ObjectExtensionPropertyInfo> GetProperties( |
|
|
|
[NotNull] this ObjectExtensionManager objectExtensionManager, |
|
|
|
[NotNull] Type objectType, |
|
|
|
[NotNull] string propertyName) |
|
|
|
{ |
|
|
|
Check.NotNull(objectExtensionManager, nameof(objectExtensionManager)); |
|
|
|
Check.NotNull(objectType, nameof(objectType)); |
|
|
|
Check.NotNull(propertyName, nameof(propertyName)); |
|
|
|
|
|
|
|
var extensionInfo = objectExtensionManager.GetOrNull(objectType); |
|
|
|
if (extensionInfo == null) |
|
|
|
{ |
|
|
|
return EmptyPropertyList; |
|
|
|
} |
|
|
|
|
|
|
|
return extensionInfo.GetProperties(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |