首页 文章

提供程序实体框架MySQL中的错误

提问于
浏览
0

我尝试在MySQL数据库中连接我的实体框架,但是当我连接这个错误发生时

没有为ADO.NET提供程序找到具有不变名称“MySql.Data.MySqlClient”的实体框架提供程序 . 确保提供程序已在应用程序配置文件的“entityFramework”部分中注册 . 有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=260882 .

这是我的类库whit实体的appConfig

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
 <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="portallentesContext" connectionString="server=******;User Id=******;password=*********;Persist Security Info=True;database=portallentes"
  providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<system.data>
<DbProviderFactories>
  <remove invariant="MySql.Data.MySqlClient" />
  <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.6.4.0" />
</DbProviderFactories>
</system.data>

<entityFramework>
<providers>
  <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.6.4.0" >
  </provider>
</providers>
</entityFramework>
</configuration>

2 回答

  • 0

    将MySql.Data.Entity.EF5.dll与MySql.Data.Entity.EF6.dll一起复制到bin目录 .

  • 0

    看看我的答案:https://stackoverflow.com/a/42588773/3652378 .

    确保在调用程序集中引用了 MySql.Data.dll (不仅在类库项目中,而且在调用类库的Web应用程序/ wcf应用程序中) .

相关问题