Try to have a connection string during at runtime or remove it from App.config.However I am getting an error.
fyi: EF 6 CodeFirst
public class DfDbContext : DbContext
{
public DfDbContext()
: base(GetConnectionString())
{
}
private static string GetConnectionString()
{
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
builder.DataSource = "xxxxx";
builder.InitialCatalog = "xxxx";
builder.UserID = "xxx";
builder.Password = "xxxx";
builder.MultipleActiveResultSets = true;
builder.PersistSecurityInfo = true;
return builder.ConnectionString.ToString();
}
}
Error
An exception of type 'System.ArgumentException' occurred in System.Data.dll but was not handled in user code
Additional information: Keyword not supported: 'initial catalog'.
Any alternative solution?