mirror of https://github.com/abpframework/abp.git
4 changed files with 38 additions and 25 deletions
@ -1,17 +1,41 @@ |
|||
using System.Collections.Generic; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.Immutable; |
|||
|
|||
namespace Volo.Abp.ObjectExtending |
|||
{ |
|||
public class ObjectExtensionInfo |
|||
{ |
|||
public Type Type { get; } |
|||
|
|||
public Dictionary<string, ObjectExtensionPropertyInfo> Properties { get; } |
|||
|
|||
public Dictionary<object, object> Configuration { get; } |
|||
|
|||
public ObjectExtensionInfo() |
|||
public ObjectExtensionInfo(Type type) |
|||
{ |
|||
Type = type; |
|||
Properties = new Dictionary<string, ObjectExtensionPropertyInfo>(); |
|||
Configuration = new Dictionary<object, object>(); |
|||
} |
|||
|
|||
public ObjectExtensionPropertyInfo AddProperty( |
|||
string propertyName, |
|||
Action<ObjectExtensionPropertyInfo> configureAction = null) |
|||
{ |
|||
var propertyInfo = Properties.GetOrAdd( |
|||
propertyName, |
|||
() => new ObjectExtensionPropertyInfo(propertyName) |
|||
); |
|||
|
|||
configureAction?.Invoke(propertyInfo); |
|||
|
|||
return propertyInfo; |
|||
} |
|||
|
|||
public ImmutableList<ObjectExtensionPropertyInfo> GetProperties() |
|||
{ |
|||
return Properties.Values.ToImmutableList(); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue