我正在使用 EntityFramework Reverse POCO Generator在 VS2012 中
VS2012...
这是我的连接字符串:
<connectionStrings>
<add name="Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlServerCe.4.0;provider connection string="data source=C:\SomeDatabase.sdf"" providerName="System.Data.EntityClient" />
</connectionStrings>
- 安装了 nuget EntityFramework.SqlServerCompact
- 为 Visual Studio 安装了 Entity Framework 6.1.0 工具
- 将 System.Data.Entity 添加到我的引用中
更新了 .tt 文件以指向我的 connectionString 并且我在保存时收到此错误(警告)::
警告 1 运行转换:无法加载提供程序“System.Data.EntityClient”- 无法找到请求的 .Net Framework 数据提供程序。它可能没有安装。
因此它不会生成任何代码。有什么想法吗?
这是 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;
...
最佳答案
找到答案了,问题出在ConnectionString
应该如下:
<connectionStrings>
<add name="Entities" connectionString="Data Source=C:\StoreContainer.sdf"
providerName="Microsoft.SqlServerCe.Client.4.0" />
</connectionStrings>
关于c# - EF反向POCO生成器: Failed to load provider EntityClient,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24313086/