I have generated entity model from AdventureWorks database; now I want to delete the connection string in app.config and set it at runtime. In the Model1.Context.cs file I h
I'd go with something like:
public AdventureWorksEntities(string server, string databaseName, string user, string password)
:base(new System.Data.EntityClient.EntityConnectionStringBuilder
{
Metadata = "res://*",
Provider = "System.Data.SqlClient",
ProviderConnectionString = new System.Data.SqlClient.SqlConnectionStringBuilder
{
InitialCatalog = databaseName,
DataSource = server,
IntegratedSecurity = false,
UserID = user,
Password = password,
}.ConnectionString
}.ConnectionString)
{
}