调试setupConnections方法时出现以下错误
public string SetupConnections(SourceDatabases database)
{
EntityConnectionStringBuilder efBuilder = new EntityConnectionStringBuilder();
try
{
string metaData = @"res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl";
string initialcatalog = "";
const string appName = "EntityFramework";
const string providerName = "System.Data.EntityClient";
if (database == SourceDatabases.COASTALCAROLINAPODIATRY)
{
initialcatalog = "COASTALCAROLINAPODIATRY";
}
if (database == SourceDatabases.COASTALVISIONCARE)
{
initialcatalog = "COASTALVISIONCARE";
}
if (database == SourceDatabases.ELEANORSAHN)
{
initialcatalog = "ELEANORSAHN";
}
if (database == SourceDatabases.GLAUCOMACONSULTANTS)
{
initialcatalog = "COASTALCAROLINAPODIATRY";
}
if (database == SourceDatabases.MARIANNEROSEN)
{
initialcatalog = "COASTALCAROLINAPODIATRY";
}
const string dataSource = "sourcenet";
SqlConnectionStringBuilder sqlBuilder = new SqlConnectionStringBuilder();
sqlBuilder.DataSource = dataSource;
sqlBuilder.InitialCatalog = initialcatalog;
sqlBuilder.MultipleActiveResultSets = true;
sqlBuilder.IntegratedSecurity = false;
sqlBuilder.UserID = "scheduler";
sqlBuilder.Password = "BORG8472";
sqlBuilder.ApplicationName = appName;
efBuilder.Metadata = metaData;
efBuilder.Provider = providerName;
efBuilder.ProviderConnectionString = sqlBuilder.ConnectionString;
}
catch(Exception EX)
{
}
return efBuilder.ConnectionString;
}
它声称以下未安装,但我在使用ef时没有遇到任何问题我的项目是另一个我需要的nuget
具有不变名称'System.Data.EntityClient'的ADO.NET提供程序是 要么未在机器或应用程序配置文件中注册,要么 无法加载。有关详细信息,请参阅内部异常。
内部:无法找到请求的.Net Framework数据提供程序。它可能不会 安装。
我的提供商只需在我的app.config
中包含以下内容即可 <providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>