标签:des style blog color io os sp div on
1 public class WBIDbContext : DbContext 2 { 3 public DbSet<SysUserMdl> Users { get; set; } 4 public DbSet<SysUserGroupMdl> UserGroups { get; set; } 5 public DbSet<SysMenuModuleMdl> MenuModules { get; set; } 6 public DbSet<SysMenuItemMdl> MenuItems { get; set; } 7 8 public DbSet<VidCameraMdl> Cameras { get; set; } 9 10 public DbSet<DevDevtypeMdl> DevType { get; set; }//增加设备表的读取 11 12 // public DbSet<VidDiskRecorderMdl> VideoHosts { get; set; } 13 14 public WBIDbContext() 15 : base("DefaultConnection") 16 { 17 } 18 }
1 public class WBIContextFactory 2 { 3 private const string KEY_DB_CONTEXT = "WBIDbContext"; 4 5 public static WBIDbContext GetCurrentContext() 6 { 7 WBIDbContext dbContext = 8 CallContext.GetData(KEY_DB_CONTEXT) as WBIDbContext; 9 10 if (dbContext == null) 11 { 12 dbContext = new WBIDbContext(); 13 CallContext.SetData(KEY_DB_CONTEXT, dbContext); 14 } 15 16 return dbContext; 17 } 18 }
1 //设备类型 2 [Table("t_dev_devtype")] 3 public class DevDevtypeMdl 4 { 5 [Key] 6 [Display(Name="设备编号")] 7 public string devid { get; set; } 8 [Display(Name = "设备编码")] 9 public string devtype { get; set; } 10 [Display(Name = "名称描述")] 11 public string devdesc { get; set; } 12 [Display(Name = "排序")] 13 public string devorder { get; set; } 14 [Display(Name = "设备备注")] 15 public string devmemo { get; set; } 16 }
不成功的MVC Repository模式,记录下来,后面看看原因在哪里(四) 上下文 及 model表
标签:des style blog color io os sp div on
原文地址:http://www.cnblogs.com/minglilee2012/p/4043803.html