日期:2014-05-20 浏览次数:20774 次
public class BaseMenu
{
[Key]
public int Id { get; set; }
[Display(Name = "名称")]
[Required(ErrorMessage = "不能为空!")]
[MaxLength(50, ErrorMessage = "长度不能超过50个字符!")]
public string Name { get; set; }
public virtual ICollection<BaseRole> Roles { get; set; }
}
public class BaseRole
{
[Key]
public int Id { get; set; }
[Display(Name = "名称")]
[Required(ErrorMessage = "不能为空!")]
[MaxLength(50, ErrorMessage = "长度不能超过50个字符!")]
public string Name { get; set; }
public virtual ICollection<BaseUser> Users { get; set; }
public virtual ICollection<BaseMenu> Menus { get; set; }
}
public class BaseUser
{
[Key]
public int Id { get; set; }
[Display(Name = "用户名")]
[Required(ErrorMessage = "用户名不能为空!")]
[MaxLength(50, ErrorMessage = "长度不能超过50个字符!")]
public string UserName { get; set; }
public virtual ICollection<BaseRole> Roles { get; set; }
}