/// <summary> /// Class Constructor - Best pratice is not to override or use this. /// Keep in mind if you do that this is called with every request and your /// context at this state is uncertian without doing pre-checking of multiple values /// </summary> public AsaMvcApplication() { String logMethodName = ".ctor() - "; BeginRequest += (o, e) => { OnAfterRequestStart(e); }; EndRequest += (o, e) => { OnAfterRequestEnd(e); }; MapRequestHandler += (o, e) => { OnAfterApplicationRequestStart(e); }; PostRequestHandlerExecute += (o, e) => { OnAfterApplicationRequestEnd(e); }; CurrentAppState = ApplicationState.NotStarted; if (!_loggingStarted) { //We load logging first and foremost so we can start tracking the //application load process as early as possible. Further this way //if logging load fails we can simply ingore it and move on //while a failure in filters or routes will cause the application startup to //abort. try { log4net.Config.XmlConfigurator.Configure(); _log.Info(logMethodName + "ASA MVC Web Application Logger Started - APPLICATION LOGGING START"); } catch (Exception ex) { //There is nothing we can do here, there is no way to log this failue //and we don't want to abort the application just because logging won't load _log.Info(logMethodName + "Exception caught. Message: " + ex.Message); } _loggingStarted = true; } //NOTE: Logging statements from this method will not show up on initial load. //post application launch they will behave normally _log.Debug(logMethodName + "Begin Method"); if (_configuration == null) { try { _log.Debug(logMethodName + "Getting ASAIntegration Config"); _configuration = (ASAIntegration)ConfigurationManager.GetSection("asaIntegration"); } catch (Exception ex) { _log.Error(logMethodName + "Unable to load integration configuration", ex); throw new MVCIntegrationException("Unable to load integration configuration", ex); } } //ASAContextLoader handles lower level lifecycle concerns //like preloading integration/content, and providing application //level context for integration interactions. //This call give the context loader an easy way to hook into the application lifecycle //at the earliest possible point. ASAContextLoader.RegisterApplication(this); _log.Debug(logMethodName + "End Method"); }
static ASAContextLoader() { String logMethodName = ".ctor() - "; _log.Debug(logMethodName + "Begin Method"); try { _log.Debug(logMethodName + "Getting ASAIntegration Config"); _configuration = (ASAIntegration)ConfigurationManager.GetSection("asaIntegration"); } catch (Exception ex) { _log.Error(logMethodName + "Unable to load integration configuration", ex); throw new MVCIntegrationException("Unable to load integration configuration", ex); } _log.Debug(logMethodName + "End Method"); }