I have a database on SQL Azure, when I run automated unit tests I try to drop the DB and recreate it.
The constructor for the context is:
public MainContext(bool dropDB)
: base("Main")
{
Database.CommandTimeout = 300;
this.Configuration.LazyLoadingEnabled = true;
System.Data.Entity.Database.SetInitializer<MainContext>(new MainContextDropInitializer());
this.Database.Connection.StateChange += Connection_StateChange;
}
However when trying to execute the code I keep getting the following error:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
The DB itself is quite small so setting a command timeout of 300 should be sufficient. Interestingly this issue only occurred since we upgrade the Azure DB to v12.
Any ideas?