zoukankan      html  css  js  c++  java
  • EntityFramework.Extended 支持 MySql

    EntityFramework.Extended 默认不支持 MySql,需要配置如下代码:

    [DbConfigurationType(typeof(DbContextConfiguration))]    //增加配置
    public class SchoolDbContext : DbContext, IDbContext
    {
        public SchoolDbContext()
            : base("name=db_connection")
        {
            Database.SetInitializer<SchoolDbContext>(null);
        }
    
        public DbSet<Student> Students { get; set; }
    
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.HasDefaultSchema("");    //增加配置
            modelBuilder.Configurations.Add(new StudentMap());
        }
    }
    
    public class DbContextConfiguration : DbConfiguration
    {
        public DbContextConfiguration()
        {
            //增加配置
            EntityFramework.Locator.Current.Register<EntityFramework.Batch.IBatchRunner>(() => new MySqlBatchRunner());
        }
    }
    
  • 相关阅读:
    New-SAN-FENG-YUN-三
    San丰-Cloud
    SpringBoot+MySQL+MyBatis+Shiro+AdminLTE
    SanFeng-Clound
    SanFengClound
    传奇音乐设置
    热血传奇GOM引擎问题集锦
    app测试
    接口测试
    题目
  • 原文地址:https://www.cnblogs.com/xishuai/p/entityframework-extended-support-mysql.html
Copyright © 2011-2022 走看看