How can I set the command timeout of a DbContext?
I found this solution after another Google search. You can access the ObjectContext for a DbContext by casting this
to an IObjectContextAdapter.
From http://social.msdn.microsoft.com/Forums/en-ZA/adodotnetentityframework/thread/6fe91a64-0208-4ab8-8667-d061af340994:
public class MyContext : DbContext
{
public MyContext ()
: base(ContextHelper.CreateConnection("my connection string"), true)
{
((IObjectContextAdapter)this).ObjectContext.CommandTimeout = 300;
}
}