簡體   English   中英

找不到實體框架提供者

[英]No Entity Framework Provider Found

我有兩個月前開始的項目! 我正在使用[LASG]: https : //layerguidance.codeplex.com/體系結構作為我的解決方案! 我收到了“沒有為ADO.net提供程序找到名稱不變的名稱'System.Data.SqlClient'的實體框架提供程序”,因此我在解決方案中工作得很好

應用程序配置文件包含提供程序的完整塊

這是我的app.config文件:

<?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>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <connectionStrings>
    <add name="MASTERGESTION" connectionString="Data Source=ZZZZ\ZZZZZ;Initial Catalog=XXXXXX;User ID=YY;Password=ZZZZZZ" providerName="System.Data.SqlClient" />
  </connectionStrings>
</configuration>

我在構建解決方案后將項目復制到其他計算機上,它可以正常啟動並且沒有提供程序錯誤

我重建了解決方案很多次,我沒有響應就手動重新添加了引用!

有什么幫助嗎? 我無緣無故地放松了六個小時

defaultConnectionFactory不應為:

System.Data.Entity.Infrastructure.LocalDbConnectionFactory 

改為:

System.Data.Entity.Infrastructure.SqlConnectionFactory

我認為它可以在第二台計算機上正常工作,因為它已安裝了LocalDb,而第一台計算機卻沒有。

嘗試代替

User ID=YY;Password=ZZZZZZ

使用

Integrate Security=True

還添加<context>

<context type="tablename, databasename">
        <databaseInitializer type="databasename.Migrations.tablenameInitializer, databasename" />
      </context>

暫無
暫無

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

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