码迷,mamicode.com
首页 > 数据库 > 详细

entity framework 查看自动生成的sql

时间:2018-04-29 18:38:11      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:public   config   database   ola   debug   ini   bom   ram   tin   

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

标签:public   config   database   ola   debug   ini   bom   ram   tin   

原文地址:https://www.cnblogs.com/jonney-wang/p/8971518.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!