You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
2.5 KiB
C#

10 months ago
 using System;
namespace HcUtility.Core
{
/// <summary>
/// 功能: 用于标示继承于ModelObjectBase中的公共属性
/// 创建: 吴伟 2009-05-07
///
/// </summary>
public class ModelDBAttribute : Attribute
{
#region 公共属性
public ModelDBOprationType MDBType
{
get { return _mdbType; }
set { _mdbType = value; }
}
public bool IsPrimary
{
get { return _isPrimary; }
set { _isPrimary = value; }
}
public string UpdFieldName
{
get { return _upFielddName; }
set { _upFielddName = value; }
}
public string UpdParamName
{
get { return _updParamName; }
set { _updParamName = value; }
}
public string InsParamName
{
get { return _insParamName; }
set { _insParamName = value; }
}
public string InsFieldName
{
get { return _insFieldName; }
set { _insFieldName = value; }
}
public string DelParamName
{
get { return _delParamName; }
set { _delParamName = value; }
}
public string DelFieldName
{
get { return _delFieldName; }
set { _delFieldName = value; }
}
public bool needInsert()
{
return need(ModelDBOprationType.Insert);
}
public bool needEdit()
{
return need(ModelDBOprationType.Edit);
}
public bool needDelete()
{
return need(ModelDBOprationType.Delete);
}
private bool need(ModelDBOprationType mot)
{
if (mot == (mot & this.MDBType)) return true;
return false;
}
#endregion
#region 私有变量
private ModelDBOprationType _mdbType = ModelDBOprationType.InsertEdit;//默认为新增和修改
private string _updParamName = String.Empty;
private string _upFielddName = String.Empty;
private string _insParamName = String.Empty;
private string _insFieldName = String.Empty;
private string _delParamName = String.Empty;
private string _delFieldName = String.Empty;
private bool _isPrimary = false;
#endregion
}
}