5

używam EntityFramework Reverse POCO Generator w VS2012EF Odwrócona POCO Generator: Nie udało się załadować dostarczający EntityClient

VS2012 ...

Oto mój ciąg połączenia:

<connectionStrings> 
    <add name="Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlServerCe.4.0;provider connection string=&quot;data source=C:\SomeDatabase.sdf&quot;" providerName="System.Data.EntityClient" /> 
    </connectionStrings> 
  • zainstalowany Nuget EntityFramework .SqlServerCompact
  • zainstalowane środowisko Entity Framework 6.1.0 Tools for Visual Studio
  • dodany System.Data.Entity do moich referencji

Zaktualizowany plik .tt zwrócić do mojego ConnectionString i otrzymuję ten błąd (ostrzeżenie), kiedy zapisać ::

Ostrzeżenie 1 Running transformację: Nie można załadować dostawcy "System.Data.EntityClient" - Nie można znaleźć żądanego dostawcy danych .Net Framework. To może nie być zainstalowane.

Tak więc nie generuje żadnego kodu. Jakieś pomysły?

oto fragment pliku Database.tt:

<#@ include file="EF.Reverse.POCO.Core.ttinclude" #> 
<# 
    // v2.5.0 
    // Please make changes to the settings below. 
    // All you have to do is save this file, and the output file(s) is/are generated. Compiling does not regenerate the file(s). 

    // Misc settings ********************************************************************************************************************** 
    // Namespace = ""; // Override the default namespace here 
    DbContextName = "MyContext"; 
    ConnectionStringName = "Entities"; // Searches for this connection string in config files listed below 
    ConfigurationClassName = "Configuration"; // Configuration, Mapping, Map, etc. This is appended to the Poco class name to configure the mappings. 
    ConfigFilenameSearchOrder = new[] { "app.config", "web.config", "app.config.transform", "web.config.transform" }; // Add more here if required. The config files are searched for in the local project first, then the whole solution second. 
    MakeClassesPartial = true; 
    ... 

Odpowiedz

3

znaleźć odpowiedź, problem był w ConnectionString

powinna być następująca:

<connectionStrings> 
    <add name="Entities" connectionString="Data Source=C:\StoreContainer.sdf" 
     providerName="Microsoft.SqlServerCe.Client.4.0" /> 
    </connectionStrings> 
1

miałem ten sam błąd, problem polegał na tym, że I błędnie zapisał nazwę ConnectionStringName w pliku Database.tt.

#@ include file="EF.Reverse.POCO.Core.ttinclude" #> 
<# 
// v2.14.3 
// Please make changes to the settings below. 
// All you have to do is save this file, and the output file(s) is/are generated. Compiling does not regenerate the file(s). 

DbContextName = "MyDbContext"; 
DbContextInterfaceBaseClasses = "IDisposable"; 
DbContextBaseClass = "DbContext"; 
ConnectionStringName = "MyDbConnection"; //<--- THIS... I misspelled this.. 
Powiązane problemy