Making the objectContext.CommandTimeout configurable? 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 &lt;appsettings&gt; node in my Web.config file:

&lt;add key="commandTimeValue" value ="60"/&gt;


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?
I do not like the name myDAL as a class name.  It is very cryptic and does not follow C# naming conventions.  I would prefer DataAccessLayer or &lt;entity&gt;DataAccessLayer where &lt;entity&gt; is the name of the class the DAL is for.

That being said, why don't you inject the timeout value into your DAL class.  The constructor could be something like

public void myDAL(int timeout)
{
    if (timeout &gt; 0)
    {
         ((IObjectContextAdapter)this).ObjectContext.CommandTimeout = timeout;
    }

    // other constructor commands
}