ln.manage/ManagedPropertyAttribute.cs

32 lines
823 B
C#

using System;
using System.Reflection;
namespace ln.manage
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public class ManagedPropertyAttribute : Attribute
{
public string Group { get; set; }
public bool ReadOnly { get; set; }
public string Name { get; set; }
public bool UniqueIdentifier { get; }
public string SourcePath { get; set; }
public ManagedPropertyAttribute()
{
}
public ManagedPropertyAttribute(FieldInfo fieldInfo)
{
Name = fieldInfo.Name;
ReadOnly = fieldInfo.IsInitOnly;
}
public ManagedPropertyAttribute(PropertyInfo propertyInfo)
{
Name = propertyInfo.Name;
ReadOnly = !propertyInfo.CanWrite;
}
}
}