using System;
namespace Core.StlMes.Client.Qcm
{
public enum FieldAttributeType
{
QueryField = 1, //如果不填,则二进制只有一位。就无法正常使用枚举的异或、与运算了。
NoQueryField = 2
}
///
/// 用来标识实体类的属性,以被转换器使用。
///
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
class FieldAttribute : Attribute
{
private string _fieldName = "";
private bool _isGetValue = false;
private FieldAttributeType _fieldAttributeType;
///
/// 字段名称
///
public string FieldName
{
get { return _fieldName; }
set { _fieldName = value; }
}
///
/// 是取Value的值还是取Text的值
///
public bool IsGetValue
{
get { return _isGetValue; }
set { _isGetValue = value; }
}
///
/// 字段类型(用于查询条件还是新增修改或者保存条件)
///
public FieldAttributeType FieldAttributeType
{
get { return _fieldAttributeType; }
set { _fieldAttributeType = value; }
}
///
/// 字段特性构造函数(默认为实体类的属性名称)
///
/// 是取Value的值还是取Text的值
///字段类型(用于查询条件还是新增修改或者保存条件)
public FieldAttribute(bool isGetValue, FieldAttributeType fieldAttributeType)
{
_isGetValue = isGetValue;
_fieldAttributeType = fieldAttributeType;
}
///
/// 字段特性构造函数
///
/// 字段名称
/// 是取Value的值还是取Text的值
///字段类型(用于查询条件还是新增修改或者保存条件)
public FieldAttribute(string fieldName, bool isGetValue, FieldAttributeType fieldAttributeType)
{
_fieldName = fieldName;
_isGetValue = isGetValue;
_fieldAttributeType = fieldAttributeType;
}
}
}