56 lines
2.1 KiB
C#
56 lines
2.1 KiB
C#
using System;
|
|
using System.Reflection;
|
|
namespace ln.manage
|
|
{
|
|
//public class ManagedProperty
|
|
//{
|
|
// public ManagedObjectProvider Provider { get; }
|
|
|
|
// public bool ReadOnly { get; }
|
|
// public string Name { get; }
|
|
// public Type Type { get; }
|
|
|
|
// public bool UniqueIdentifier { get; }
|
|
|
|
// public string SourcePath { get; }
|
|
|
|
// Func<object,object> getter;
|
|
// Action<object,object> setter;
|
|
|
|
// private ManagedProperty(ManagedObjectProvider provider)
|
|
// {
|
|
// Provider = provider;
|
|
// }
|
|
// private ManagedProperty(ManagedObjectProvider provider,ManagedPropertyAttribute managedPropertyAttribute)
|
|
// {
|
|
// if (managedPropertyAttribute.Group == null)
|
|
// managedPropertyAttribute.Group = Provider.DefaultName;
|
|
|
|
// ReadOnly = managedPropertyAttribute.ReadOnly;
|
|
// Name = managedPropertyAttribute.Name;
|
|
// SourcePath = managedPropertyAttribute.SourcePath;
|
|
// UniqueIdentifier = managedPropertyAttribute.UniqueIdentifier;
|
|
// }
|
|
// public ManagedProperty(ManagedObjectProvider provider, FieldInfo fieldInfo)
|
|
// : this(provider, fieldInfo.GetCustomAttribute<ManagedPropertyAttribute>() ?? new ManagedPropertyAttribute(fieldInfo))
|
|
// {
|
|
// Type = fieldInfo.FieldType;
|
|
// getter = fieldInfo.GetValue;
|
|
// if (!ReadOnly)
|
|
// setter = fieldInfo.SetValue;
|
|
// }
|
|
// public ManagedProperty(ManagedObjectProvider provider, PropertyInfo propertyInfo)
|
|
// :this(provider, propertyInfo.GetCustomAttribute<ManagedPropertyAttribute>() ?? new ManagedPropertyAttribute(propertyInfo))
|
|
// {
|
|
// Type = propertyInfo.PropertyType;
|
|
// getter = propertyInfo.GetValue;
|
|
// if (!ReadOnly)
|
|
// setter = propertyInfo.SetValue;
|
|
// }
|
|
|
|
// public object GetValue(object managedObject) => getter(managedObject);
|
|
// public void SetValue(object managedObject, object v) => setter(managedObject, v);
|
|
|
|
//}
|
|
}
|