框架程序中定義了BindFIEldAttribute類型,該類型就保存了對象的屬性映射的數據庫字段的名稱,轉換格式和關鍵字段樣式,其源代碼為
[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