c# - 去年迁移有效,但现在不行了

标签 c# mysql entity-framework

迁移去年有效,但现在不行了,我该怎么办?

错误:

PM> update-database
Specify the '-Verbose' flag to view the SQL statements being applied to the target database. System.Runtime.Serialization.SerializationException: O tipo não foi resolvido para o associado 'MySql.Data.MySqlClient.MySqlException,MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'. em System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
em System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner) em System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force) em System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0() em System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command) The type has not been resolved to the associated 'MySql.Data.MySqlClient.MySqlException,MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'.
PM>

代码(部分)

<configuration>
  <configSections>
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>      
  <connectionStrings>
        <add name="DefaultConnection" connectionString="Data Source=mySERVER;initial catalog=myDB;Integrated Security=false;uid=myID;pwd=myPWD;"  providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <appSettings>
  <!-- I will show only if needed -->
  </appSettings>
  <system.web>
  <!-- I will show only if needed -->
  </system.web>
  <system.webServer>
    <modules>
      <!-- I will show only if needed -->
    </modules>

    <handlers>

       <!-- I will show only if needed -->
    </handlers>
 </system.webServer>
  <runtime>
  <!-- I will show only if needed -->
  </runtime>
  <system.data>
   <DbProviderFactories>
    <!-- I will show only if needed -->
   </DbProviderFactories>
  </system.data>

  <entityFramework>
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>

最佳答案

配置文件中的唯一连接字符串似乎指向以“System.Data.SqlClient”作为唯一提供者的服务器; ...堆栈跟踪对 MySQL 表示不满。

我猜你需要提供一个支持MySQL的。

但我要指出的是,我没有在同一个项目中与多个提供商合作:)

关于c# - 去年迁移有效,但现在不行了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36458633/

相关文章:

PHPUnit_Extensions_Database_Testcase 返回未定义的方法

c# - Entity Framework 连接字符串问题

c# - 从项目内的注释或 XML 文档生成 WCF 实现/使用文档

BIGINT 的 PHP/MYSQL 问题

mysql - 在 MySQL 中使用 Time 数据类型,无需秒

entity-framework - VS 2012-EF 5.0-从数据库更新模型-不获取表更改

c# - DbContext 是一项昂贵的操作吗?

c# - 错误 1215 : Cannot add foreign key constraint MySQL Error

c# - 将 'Type' 传递给通用构造函数

c# - C# 中的 Array.ICollection.Count 属性