1、我的
[Table("UserInfo")] public class UserInfo { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int UserId { get; set; } public string Name { get; set; } public string Password { get; set; } public virtual List<PermissionGroup> UserPGroup { get; set; } } [Table("Permission")] public class Permission { public Permission() { } public Permission(string module, string pCode, string pdesc) { this.Module = new Module(module, pCode); this.Name = pdesc; } [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Pid { get; set; } public string Name { get; set; } public Module Module { get; set; } public virtual List<PermissionGroup> groups { get; set; } } [Table("PermissionGroup")] public class PermissionGroup { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int GroupId { get; set; } public string GroupName { get; set; } public virtual List<Permission> ListPermission { get; set; } public virtual List<UserInfo> Users { get; set; } } [ComplexType] public class Module { public Module() { } public Module(string moduleName,string pCode) { this.ModuleName = moduleName; this.PermissionCode = pCode; } public string ModuleName { get; set; } public string PermissionCode { get; set; } }
2、 下载demo