【问题标题】:What happened to System.Data.Entity.DbConfiguration class in EF7EF7 中的 System.Data.Entity.DbConfiguration 类发生了什么
【发布时间】:2015-07-31 23:03:42
【问题描述】:

我正在尝试为 EF7 添加 MySQL 连接器/网络提供程序:使用以下方法之一。但是 System.Data.Entity 在 EF7 中没有 DbConfiguration 类。此类是否已被移动,或者我是否需要做一些不同的事情来添加 MySQl 提供程序?

1)在上下文类中添加DbConfigurationTypeAttribute

[DbConfigurationType(typeof(MySqlEFConfiguration))]

2)调用

DbConfiguration.SetConfiguration(new MySqlEFConfiguration()) 

在应用程序启动时

【问题讨论】:

    标签: mysql entity-framework entity-framework-6 entity-framework-core


    【解决方案1】:

    EF 7 将使用与 EF 6 不同的配置模式。有关配置 DbContext 的详细示例,请查看我们在 Github 上的 Wiki 页面。

    https://github.com/aspnet/EntityFramework/wiki/Configuring-a-DbContext

    另外,EF 7 的 MySQL 提供程序尚不可用。

    【讨论】:

      猜你喜欢
      • 2015-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-09
      相关资源
      最近更新 更多