我正在使用 VS2012中的EntityFramework Reverse POCO Generator
... 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>
更新了.tt文件以指向我的connectionString,当我保存::
时出现此错误(警告)警告1正在运行转换:无法加载提供程序&#34; System.Data.EntityClient&#34; - 无法找到请求的.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;
...
答案 0 :(得分:4)
找到答案,问题出在ConnectionString
中应如下:
<connectionStrings>
<add name="Entities" connectionString="Data Source=C:\StoreContainer.sdf"
providerName="Microsoft.SqlServerCe.Client.4.0" />
</connectionStrings>
答案 1 :(得分:2)
我遇到了同样的错误,问题是我在Database.tt文件中拼错了ConnectionStringName 。
#@ 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..