/// <summary> /// Fires after startup and calls the callback once customizations are locked /// </summary> /// <param name="afterComplete"></param> /// <returns></returns> public virtual IBootManager Complete(Action <ApplicationContext> afterComplete) { if (_isComplete) { throw new InvalidOperationException("The boot manager has already been completed"); } FreezeResolution(); //stop the timer and log the output _timer.Dispose(); //call OnApplicationStarting of each application events handler ApplicationEventsResolver.Current.ApplicationEventHandlers .ForEach(x => x.OnApplicationStarted(UmbracoApplication, ApplicationContext)); //Now, startup all of our legacy startup handler ApplicationEventsResolver.Current.InstantiateLegacyStartupHandlers(); if (afterComplete != null) { afterComplete(ApplicationContext.Current); } _isComplete = true; // we're ready to serve content! ApplicationContext.IsReady = true; return(this); }
/// <summary> /// Fires after startup and calls the callback once customizations are locked /// </summary> /// <param name="afterComplete"></param> /// <returns></returns> public virtual IBootManager Complete(Action <ApplicationContext> afterComplete) { if (_isComplete) { throw new InvalidOperationException("The boot manager has already been completed"); } FreezeResolution(); //Here we need to make sure the db can be connected to EnsureDatabaseConnection(); //This is a special case for the user service, we need to tell it if it's an upgrade, if so we need to ensure that // exceptions are bubbled up if a user is attempted to be persisted during an upgrade (i.e. when they auth to login) ((UserService)ApplicationContext.Services.UserService).IsUpgrading = true; using (ProfilingLogger.DebugDuration <CoreBootManager>( string.Format("Executing {0} IApplicationEventHandler.OnApplicationStarted", ApplicationEventsResolver.Current.ApplicationEventHandlers.Count()), "Finished executing IApplicationEventHandler.OnApplicationStarted")) { //call OnApplicationStarting of each application events handler ApplicationEventsResolver.Current.ApplicationEventHandlers .ForEach(x => { try { using (ProfilingLogger.DebugDuration <CoreBootManager>(string.Format("Executing {0} in ApplicationStarted", x.GetType()))) { x.OnApplicationStarted(UmbracoApplication, ApplicationContext); } } catch (Exception ex) { ProfilingLogger.Logger.Error <CoreBootManager>("An error occurred running OnApplicationStarted for handler " + x.GetType(), ex); throw; } }); } //Now, startup all of our legacy startup handler ApplicationEventsResolver.Current.InstantiateLegacyStartupHandlers(); if (afterComplete != null) { afterComplete(ApplicationContext.Current); } _isComplete = true; // we're ready to serve content! ApplicationContext.IsReady = true; //stop the timer and log the output _timer.Dispose(); return(this); }
/// <summary> /// Fires after startup and calls the callback once customizations are locked /// </summary> /// <param name="afterComplete"></param> /// <returns></returns> public virtual IBootManager Complete(Action <ApplicationContext> afterComplete) { if (_isComplete) { throw new InvalidOperationException("The boot manager has already been completed"); } //freeze resolution to not allow Resolvers to be modified Resolution.Freeze(); //stop the timer and log the output _timer.Dispose(); if (afterComplete != null) { afterComplete(ApplicationContext.Current); } _isComplete = true; return(this); }