通过继承User<TEntity>类增加一个字段
/// <summary>用户信息</summary>
[Serializable]
[ModelCheckMode(ModelCheckModes.CheckTableWhenFirstUse)]
[BindIndex("IX_User_DepartmentId", false, "DepartmentId")]
[BindRelation("DepartmentId", false, "Department", "ID")]
public partial class Users : User<Users>
{
private Int32 _DepartmentId;
/// <summary>部门编号</summary>
[DisplayName("部门编号")]
[Description("部门编号")]
[DataObjectField(false, false, true, 10)]
[BindColumn(14, "DepartmentId", "部门编号", null, "int", 10, 0, false)]
public virtual Int32 DepartmentId
{
get { return _DepartmentId; }
set { if (OnPropertyChanging("DepartmentId", value)) { _DepartmentId = value; OnPropertyChanged("DepartmentId"); } }
}
}
这样做后虽然得到了新的用户表,但是原有的用户表依然存在,经过一番询问之后知道还要继承一个类ManageProvider<TUser>
class EMSManageProvider : ManageProvider<Users> { }
到此,扩展User类增加部门字段顺利完成。
时间: 2024-10-17 23:02:12