簡體   English   中英

提供者實體框架MySQL中的錯誤

[英]Error in provider Entity Framework MySQL

我嘗試在MySQL數據庫中連接我的實體框架,但是當我連接時發生此錯誤

未找到具有不變名稱“ MySql.Data.MySqlClient”的ADO.NET提供程序的實體框架提供程序。 確保提供程序已在應用程序配置文件的“ entityFramework”部分中注冊。 有關更多信息,請參見http://go.microsoft.com/fwlink/?LinkId=260882

這是我的類庫白色實體的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>

將帶有MySql.Data.Entity.EF6.dll的MySql.Data.Entity.EF5.dll復制到bin目錄。

在這里查看我的答案: https : //stackoverflow.com/a/42588773/3652378

確保在調用程序集中引用了MySql.Data.dll (不僅在類庫項目中,而且在調用類庫的Web應用程序/ wcf應用程序中)都已引用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM