Ok then.
I would create a base class for all your "data access layer" classes.
public class DataBaseLayer ()
{
public DataBaseLayer()
{ /* check for appSetting here and throw a SqlServerMaintenanceModeException exception (custom exception) */}
}
public class EmployeeDataLayer : DataBaseLayer ()
{
public EmployeeDataLayer() : base ()
}
In the constructor, I would check an appSetting...for "true" or "false".........and throw a CustomException
public class SqlServerMaintenanceModeException : ApplicationException
{}
throw it in the constructor of the DataBaseLayer......then have everything else handle it.
That way...only "db driven" pages are affected.
The small reason I don't like checking for a "timeout" is that..
- It is a tad unpredictable.
- Sometimes that is a normal exception.............like a switch on your network goes by. How will you tell the difference?
I dislike ambiguous exceptions tremendously.