Ejemplo n.º 1
0
        /// <summary>
        /// 应用程序启动事件方法
        /// </summary>
        protected virtual void Application_Start()
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();

            //DependencyResolver.SetResolver(new NinjectDependencyResolver(AddBindings));
            var logInfo = new JLogInfo
            {
                LogType    = JLogType.Info.ToString(),
                Message    = "Application_Start",
                ActionName = "Application_Start",
                ModuleName = "MvcApplication"
            };

            GetAllAssemblys();

            ResHelper.CombinAssemblyResx(Assemblys);
            AddBindings(SiteManager.Kernel);

            AppManager.Instance.UserProvider  = SiteManager.Kernel.Get <IDataProvider <AppUser> >();
            AppManager.Instance.RoleProvider  = SiteManager.Kernel.Get <IDataProvider <AppRole> >();
            AppManager.Instance.StateProvider = SiteManager.Kernel.Get <IStateProvider>();
            SiteManager.Init();

            SiteManager.Get <UserConfigStorage <UserConfig> >();
            var resFileWriter = new ResFileWriter();

            resFileWriter.WriteResFiles();
            sw.Stop();
            logInfo.Costs = sw.ElapsedMilliseconds;

            LogHelper.Write(logInfo);
            //初始化日程表的基础数据栏目
            SiteManager.Catalog.InitStaticCatalogs(typeof(ScheduleEvent));
            AreaRegistration.RegisterAllAreas();
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            SiteManager.Catalog.InitStaticCatalogs(typeof(MessageRoot));
            //开启数据库更新
            //if (!DbSchemaVersionManager.GetInstance.ValidateVersion())
            //{
            //    DbSchemaVersionManager.GetInstance.UpdateDbSchemaToMaxVersion();
            //}
        }