zoukankan      html  css  js  c++  java
  • entity framework 查看自动生成的sql

    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     }
  • 相关阅读:
    mac重启nginx时报nginx.pid不存在的解决办法
    js 正则表达式
    js 闭包
    js yarn
    js npm
    vue3 vite
    node 错误处理
    node fs
    linux包管理工具使用和区别(转)
    MySQL数据库学习----理论基础
  • 原文地址:https://www.cnblogs.com/jonney-wang/p/8971518.html
Copyright © 2011-2022 走看看