I am trying to make the CommandTimeout value more configurable. I'm wondering if this is best practice to do so?
I add the following to my <appsettings>
node in my Web.config file:
<add key="commandTimeValue" value ="60"/>
The I added the following to the top of my controllers under the :
using (var db = new myDAL())...
Int32 timeoutVal = Convert.ToInt32
(System.Web.Configuration.WebConfigurationManager.AppSettings["commandTimeValue"]);
((IObjectContextAdapter)db).ObjectContext.CommandTimeout = timeoutVal;
Is this the right way to do this? What are some other alternatives?