コード例 #1
0
        /// <summary>
        ///     Handles the Start event of the Application control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Application_Start(object sender, EventArgs e)
        {
            var modules =
                new IContainerModule[]
            {
                new AdContainerModule(),
                new CommonContainerModule(),
                new EnginesContainerModule(),
                new CommonPluginsContainerModule(),
                new PluginsContainerModule(),
                new RepositoryContainerModule(),
                new CoreContainerModule(),
                new QueryContainerModule(),
                new EnginesDslModule(),
                new InfrastructureContainerModule(),
                new UserInterfaceInfrastructureContainerModule(),
                new PackagesContainerModule(),
                new DbMigrationsModule(),
                new DbUpdateCommonModule(),
                new DbActionsModule(),
                new RequestHandlingModule(),
                new ReportContainerModule(),
                new RulesContainerModule(),
                new NotificationsContainerModule(),
                new WorkflowContainerModule(),
                new ScanWorkflowModule(),
                new SchedulerContainerModule(),
                new GitHubWorkflowContainerModule()
            };

            IoC.InitDefault(ReuseScope.PerRequest, modules);

            var globalContainer = IoC.GetContainer();

            var migrator = globalContainer.Resolve <IDbMigrator>();

            migrator.MigrationLatest();

            EnvironmentInitializer.Initialize(
                modules,
                ReuseScope.Container,
                container =>
            {
                var env = container.Resolve <IEnvironmentProvider>();

                env.Prepare();
            });

            _schedulerContainer = EnvironmentInitializer.InitializeContainer(modules, ReuseScope.Hierarchy);
            JobScheduler        = _schedulerContainer.Resolve <IJobScheduler>();
            JobScheduler.Start(true);

            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
        }