In my web site I have regular ADO.NET connection string like: ,
now Entity Framework added it's own connection string to same database.
How is it possible to use only one ADO.NET connection string and build Entity Connection string in runtime?
In my web site I have regular ADO.NET connection string like: ,
now Entity Framework added it's own connection string to same database.
How is it possible to use only one ADO.NET connection string and build Entity Connection string in runtime?
you can use EntityConnectionStringBuilder to generate connection string at runtime dynamically at runtime but you still need metada for this
EntityConnectionStringBuilder entityBuilder =
new EntityConnectionStringBuilder();
//Set the provider name.
entityBuilder.Provider = providerName;
// Set the provider-specific connection string.
entityBuilder.ProviderConnectionString = providerString;
// Set the Metadata location.
entityBuilder.Metadata = @"res://*/AdventureWorksModel.csdl|
res://*/AdventureWorksModel.ssdl|
res://*/AdventureWorksModel.msl";
using (EntityConnection conn =
new EntityConnection(entityBuilder.ToString()))
{
conn.Open();
Console.WriteLine("Just testing the connection.");
conn.Close();
}