I developed Asp.net application with Entity Framework and now i need to change entity connection string at run time.I tried following way.
public class DataLayer(){
static DataLayer()
{
((EntityConnection)_dbEntity.Connection).StoreConnection.ConnectionString = GetConnectionString();
//GetConnectonString() returns "user id=xxxx;password=xxxx;database=xxxx;server=xxx.xxx.xx.xx"
}
static DBContext _dbEntity = new DBContext();
//other codes
}
And I checked following links too.Still I couldn't change it.
http://msdn.microsoft.com/en-us/library/bb738533(v=vs.90).aspx