标签:实现 div ble auto col ase 映射 prot config
1.实现方法:
public class MyContext : DbContext { public MyContext() : base("name=MyContext") { Database.SetInitializer(new MigrateDatabaseToLatestVersion<MyContext,MyConfiguration>()); //重要 } public virtual DbSet<Student> Students { get; set; } public virtual DbSet<Course> Courses { get; set; } } internal sealed class MyConfiguration : DbMigrationsConfiguration<MyContext> { public MyConfiguration() { AutomaticMigrationsEnabled = true; AutomaticMigrationDataLossAllowed = true; } protected override void Seed(MyContext context) { } }
标签:实现 div ble auto col ase 映射 prot config
原文地址:http://www.cnblogs.com/zhuxiang1633/p/7861166.html