这里提供生成器生成的实体类,以说明基类的作用
折叠展开C# Code复制内容到剪贴板
- #region====Tb_UserEntity====
-
-
-
- [Serializable]
- public class Users : EntityBase
- {
- public Users()
- {
- Ini();
- }
-
- void Ini()
- {
- base.IniMember(
- new string[] { ID_FieldName, UserName_FieldName, RegCap_FieldName, UserGroup_FieldName, IsAdmin_FieldName, AddDate_FieldName, Remark_FieldName },
- new object[] { 0, string.Empty, 0, 0, false, DateTime.Now, string.Empty });
- base.TableName = Users_TableName;
- base.AutoIncrements = AutoIncrement;
- base.PrimaryKeyFields = PrimaryKeyField;
- }
-
-
- #region====数据表名称、主键字段名称、数据表字段名称、自动增长型字段名称
-
-
-
- public const string Users_TableName = "Tb_User";
-
-
-
-
- public readonly static string[] PrimaryKeyField = new string[] { "ID" };
-
-
-
-
- public const string AutoIncrement = "ID";
-
-
-
-
- public const string ID_FieldName = "ID";
-
-
-
- public const string UserName_FieldName = "UserName";
-
-
-
- public const string RegCap_FieldName = "RegCap";
-
-
-
- public const string UserGroup_FieldName = "UserGroup";
-
-
-
- public const string IsAdmin_FieldName = "IsAdmin";
-
-
-
- public const string AddDate_FieldName = "AddDate";
-
-
-
- public const string Remark_FieldName = "Remark";
-
- #endregion
-
- #region====字段属性====
-
-
-
- public int ID
- {
- get
- {
-
- return Convert.ToInt32(GetProperty(ID_FieldName));
- }
- set
- {
-
- SetProperty(ID_FieldName, value);
- }
- }
-
-
-
- public string UserName
- {
- get
- {
- return Convert.ToString(GetProperty(UserName_FieldName));
- }
- set
- {
- SetProperty(UserName_FieldName, value);
- }
- }
-
-
-
- public decimal RegCap
- {
- get
- {
- return Convert.ToDecimal(GetProperty(RegCap_FieldName));
- }
- set
- {
- SetProperty(RegCap_FieldName, value);
- }
- }
-
-
-
- public int UserGroup
- {
- get
- {
- return Convert.ToInt32(GetProperty(UserGroup_FieldName));
- }
- set
- {
- SetProperty(UserGroup_FieldName, value);
- }
- }
-
-
-
- public bool IsAdmin
- {
- get
- {
- return Convert.ToBoolean(GetProperty(IsAdmin_FieldName));
- }
- set
- {
- SetProperty(IsAdmin_FieldName, value);
- }
- }
-
-
-
- public DateTime AddDate
- {
- get
- {
- return Convert.ToDateTime(GetProperty(AddDate_FieldName));
- }
- set
- {
- SetProperty(AddDate_FieldName, value);
- }
- }
-
-
-
- public string Remark
- {
- get
- {
- return Convert.ToString(GetProperty(Remark_FieldName));
- }
- set
- {
- SetProperty(Remark_FieldName, value);
- }
- }
-
- #endregion
-
- #region=====表关系属性,可以手动将实体类作为该实体的属性====
-
-
- #endregion
- }
- #endregion
通过调用基类的方法,彻底摒弃了使用反射造成的性能损失,数据表相关字段的映射也使用常量声明,提高了系统运行性能