コード例 #1
0
        /// <exclude />
        public static void Application_End(object sender, EventArgs e)
        {
            if (RuntimeInformation.IsDebugBuild)
            {
                Log.LogInformation(_verboseLogEntryTitle, "AppDomain {0} ended at {1} in process {2}", AppDomain.CurrentDomain.Id, DateTime.Now.ToString("HH:mm:ss:ff"), Process.GetCurrentProcess().Id);
            }

            if (!SystemSetupFacade.IsSystemFirstTimeInitialized)
            {
                return;
            }


            using (ThreadDataManager.Initialize())
            {
                try
                {
                    CodeGenerationManager.ValidateCompositeGenerate(_startTime);
                    CodeGenerationManager.GenerateCompositeGeneratedAssembly();
                }
                catch (Exception ex)
                {
                    Log.LogCritical("Global.asax", "Error updating Composite.Generated.dll");
                    Log.LogCritical("Global.asax", ex);
                }

                try
                {
                    GlobalEventSystemFacade.PrepareForShutDown();
                    if (RuntimeInformation.IsDebugBuild)
                    {
                        LogShutDownReason();
                    }
                    GlobalEventSystemFacade.ShutDownTheSystem();

                    TempDirectoryFacade.OnApplicationEnd();
                }
                catch (Exception ex)
                {
                    Log.LogCritical("Global.asax", ex);

                    throw;
                }

                Log.LogVerbose("Global.asax", string.Format("--- Web Application End, {0} Id = {1}---",
                                                            DateTime.Now.ToLongTimeString(),
                                                            AppDomain.CurrentDomain.Id));
            }
        }
コード例 #2
0
        /// <exclude />
        public static void TransformConfiguration(Func <XDocument, bool> transformer)
        {
            using (GlobalInitializerFacade.CoreLockScope)
            {
                lock (_lock)
                {
                    XDocument document = XDocumentUtils.Load(ConfigurationServices.FileConfigurationSourcePath);

                    if (transformer(document))
                    {
                        ValidateConfigurationFile(document);

                        // Kill monitoring of file changes:
                        //                        FileConfigurationSource.ResetImplementation(ConfigurationServices.FileConfigurationSourcePath, false);
                        document.SaveToFile(ConfigurationServices.FileConfigurationSourcePath);
                        _configurationSource = new FileConfigurationSource(ConfigurationServices.FileConfigurationSourcePath);
                        // Kill monitoring of file changes:
                        //                        FileConfigurationSource.ResetImplementation(ConfigurationServices.FileConfigurationSourcePath, false);

                        GlobalEventSystemFacade.ShutDownTheSystem();
                    }
                }
            }
        }