Giter Club home page Giter Club logo

quickdapper's Introduction

常见问题

两个方法过程如图所示:

解决方法:将图中的False改成True就好了:

安装MySQL For Visual Studio和Connector/NET:

解决方案: 需要在Context指定Mysql的配置文件。 [DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))]

Code First 多上下文操作

默认情况下:

  • Enable-Migrations
  • Update-Database

SqlServer 和 MySql 两个上下文配置:

  • Enable-Migrations -ContextTypeName Quick.Models.DataContext -MigrationsDirectory SqlServerMigrations
  • Enable-Migrations -ContextTypeName Quick.Models.MySqlDataContext -MigrationsDirectory MySqlMigrations
  • 为了便于区分两个上下文的配置,可将两个Configuration类名称分别改为SqlServerConfigMySqlConfig
  • 其次还要注意 entityFramework 节点中 provider 的配置
  • Add-Migration Initial -ConfigurationTypeName SqlServerConfig
  • Add-Migration Initial -ConfigurationTypeName MySqlConfig
  • Update-Database -ConfigurationTypeName SqlServerConfig
  • Update-Database -ConfigurationTypeName MySqlConfig

SqlServer 和 MySql 两个上下文配置,并开启自动迁移:

  • Update-Database -ConfigurationTypeName SqlServerConfig -Force
  • Update-Database -ConfigurationTypeName MySqlConfig -Force

quickdapper's People

Contributors

run2948 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

James Cloos avatar

Forkers

andyshao

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.