1. 程式人生 > >entity framework 查看自動生成的sql

entity framework 查看自動生成的sql

pan frame led auto deb tel config ring div

1         public MesDbContext() : base("name=mysql")
2         {
3             Database.Log = new Action<string>(msg => Debug.WriteLine(msg));
4         }
 1     [DbConfigurationType(typeof(MySqlEFConfiguration))]
 2     public class MesDbContext: DbContext
 3     {
 4         static MesDbContext()
5 { 6 Database.SetInitializer(new MigrateDatabaseToLatestVersion<MesDbContext, MigrateConfig>()); 7 } 8 9 public MesDbContext() : base("name=mysql") 10 { 11 Database.Log = new Action<string>(msg => Debug.WriteLine(msg)); 12 }
13 14 public DbSet<User> Users { get; set; } 15 public DbSet<Mat> Mats { get; set; } 16 public DbSet<Bom> Boms { get; set; } 17 18 } 19 20 21 public class MigrateConfig : DbMigrationsConfiguration<MesDbContext> 22 { 23 public MigrateConfig()
24 { 25 AutomaticMigrationsEnabled = true; 26 AutomaticMigrationDataLossAllowed = true; 27 } 28 }

entity framework 查看自動生成的sql