C#发现之旅:使用反射和特性构造自己的ORM框架(上)
2010-09-30 21:08:53 来源:WEB开发网[System.AttributeUsage( System.AttributeTargets.Property , AllowMultiple = false ) ]
public class BindFieldAttribute : System.Attribute
{
/// <summary>
/// 初始化对象
/// </summary>
public BindFieldAttribute( )
{
}
/// <summary>
/// 初始化对象
/// </summary>
/// <param name="name">字段名</param>
public BindFieldAttribute( string name )
{
strName = name ;
}
private string strName = null;
/// <summary>
/// 数据字段名
/// </summary>
public string Name
{
get
{
return strName ;
}
}
private bool bolKey = false;
/// <summary>
/// 该字段为关键字段,可用作查询条件
/// </summary>
public bool Key
{
get
{
return bolKey ;
}
set
{
bolKey = value;
}
}
private string strReadFormat = null;
/// <summary>
/// 数据读取格式化字符串
/// </summary>
public string ReadFormat
{
get
{
return strReadFormat ;
}
set
{
strReadFormat = value ;
}
}
private string strWriteFormat = null;
/// <summary>
/// 数据存储格式化字符串
/// </summary>
public string WriteFormat
{
get
{
return strWriteFormat ;
}
set
{
strWriteFormat = value;
}
}
}//public class BindFieldAttribute : System.Attribute
更多精彩
赞助商链接