日期:2014-05-17 浏览次数:20415 次
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel.DataAnnotations; namespace DataEntity { [Table("Sys_Menu")] public class Menu { [Key] [Display(Name = "菜单编号")] [Column(Order = 0)] [Required(ErrorMessage = "菜单编号必须提供")] public int MenuID { get; set; } [Display(Name = "菜单名称")] [Column(Order = 1)] [Required(ErrorMessage = "菜单名称必须提供")] [StringLength(50, ErrorMessage = "不能超过50个字符")] public string MenuName { get; set; } [Display(Name = "排序号")] [Column(Order = 2)] [Required(ErrorMessage = "排序号必须提供")] [MaxLength(3, ErrorMessage = "排序号长度不能超过3位")] public int OrderCode { get; set; } [Display(Name = "访问地址")] [Column(Order = 3)] [StringLength(100, ErrorMessage = "访问地址不能超过100个字符")] public string Url { get; set; } [Display(Name = "父菜单")] [Column(Order = 4)] [Required(ErrorMessage = "父菜单必须提供")] public int ParentID { get; set; } /// <summary> /// 1个菜单有1个或多个功能点 /// </summary> public virtual ICollection<Function> Functions { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel.DataAnnotations; namespace DataEntity { [Table("Sys_Function")] public class Function { /// <summary> /// 主键ID /// </summary> [Key] public int FunctionID { get; set; } /// <summary> /// 模块ID /// </summary> public int MenuID { get; set; } /// <summary> /// 功能编码 /// </summary> public string FunctionCode { get; set; } /// <summary> /// 功能名称 /// </summary> public string FunctionName { get; set; } /// <summary> /// 功能点对应的菜单实体 /// </summary> [ForeignKey("MenuID")] public virtual Menu Menu { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel.DataAnnotations; namespace DataEntity { [Table("Sys_User")] public class User { [Key] [Display(Name = "用户编号")] [Column(Order = 0)] public int UserID { get; set; } [Display(Name = "用户名")] [Column(Order = 1)] [Required(ErrorMessage = "用户名必须提供")] [StringLength(50, ErrorMessage = "不能超过50个字符")] public string UserName { get; set; } [Display(Name = "用户姓名")] [Column(Order = 2)] [Required(ErrorMessage = "用户姓名必须提供")] [StringLength(50, ErrorMessage = "不能超过50个字符")] public string RealName { get; set; } [Display(Name = "密码")] [Column(Order = 3)] [Required(ErrorMessage = "登录密码必须提供")] [StringLength(50, ErrorMessage = "不能超过50个字符")] [Dat