EF Reverse POCO Generator: Failed to load provider EntityClient

c# entity-framework-6 poco sql-server-ce visual-studio-2012

Question

I'm using EntityFramework Reverse POCO Generator in VS2012

VS2012...

Here's my connection string:

<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>
  • installed nuget EntityFramework.SqlServerCompact
  • installed Entity Framework 6.1.0 Tools for Visual Studio
  • added System.Data.Entity to my references

Updated the .tt file to point to my connectionString and I get this error (warning) when I save::

Warning 1 Running transformation: Failed to load provider "System.Data.EntityClient" - Unable to find the requested .Net Framework Data Provider. It may not be installed.

So it is not generating any code. Any ideas?

here's a snippet of the Database.tt file:

<#@ 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;
    ...
1
6
6/19/2014 5:43:16 PM

Accepted Answer

Found the answer, the problem was in the ConnectionString

should be as follows:

  <connectionStrings>
    <add name="Entities" connectionString="Data Source=C:\StoreContainer.sdf"
      providerName="Microsoft.SqlServerCe.Client.4.0" />
  </connectionStrings>
5
6/19/2014 5:47:23 PM

Popular Answer

I had the same error, the problem was I misspelled the ConnectionStringName in the Database.tt file.

#@ 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..


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow