示例#1
0
文件: Program.cs 项目: TinOroz/Rhetos
        private static void InitializeGeneratedApplication(ILogger logger, DeployArguments arguments)
        {
            // Creating a new container builder instead of using builder.Update, because of severe performance issues with the Update method.
            Plugins.ClearCache();

            logger.Trace("Loading generated plugins.");
            var stopwatch = Stopwatch.StartNew();

            var builder = new ContainerBuilder();
            builder.RegisterModule(new AutofacModuleConfiguration(
                deploymentTime: false,
                configurationArguments: arguments));

            using (var container = builder.Build())
            {
                var performanceLogger = container.Resolve<ILogProvider>().GetLogger("Performance");
                var initializers = ApplicationInitialization.GetSortedInitializers(container);

                performanceLogger.Write(stopwatch, "DeployPackages.Program: New modules and plugins registered.");
                Plugins.LogRegistrationStatistics("Initializing application", container);

                if (!initializers.Any())
                {
                    logger.Trace("No server initialization plugins.");
                } else
                {
                    foreach (var initializer in initializers)
                        ApplicationInitialization.ExecuteInitializer(container, initializer);
                }
            }

            RestartWebServer(logger);
        }
示例#2
0
        private static void InitializeGeneratedApplication(ILogger logger, Arguments arguments)
        {
            // Creating a new container builder instead of using builder.Update, because of severe performance issues with the Update method.
            Plugins.ClearCache();

            logger.Trace("Loading generated plugins.");
            var stopwatch = Stopwatch.StartNew();

            var builder = new ContainerBuilder();

            builder.RegisterModule(new AutofacModuleConfiguration(
                                       deploymentTime: false,
                                       shortTransaction: arguments.ShortTransactions,
                                       deployDatabaseOnly: arguments.DeployDatabaseOnly));
            using (var container = builder.Build())
            {
                var performanceLogger = container.Resolve <ILogProvider>().GetLogger("Performance");
                performanceLogger.Write(stopwatch, "DeployPackages.Program: New modules and plugins registered.");
                Plugins.LogRegistrationStatistics("Initializing application", container);

                container.Resolve <ApplicationInitialization>().ExecuteInitializers();
            }
        }