Beispiel #1
0
        protected void Application_Start()
        {
            //初始化IoC
            IoCHelper.InitializeWith(new DependencyResolverFactory());

            //注册自定义的控制器,使MVC控制器可以支持依赖注入
            ControllerBuilder.Current.SetControllerFactory(new ResolverControllerFactory().GetControllerFactory());

            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
        }
Beispiel #2
0
        protected void Application_Start()
        {
            //初始化IoC
            IoCHelper.InitializeWith(new DependencyResolverFactory());
            //注册自定义的控制器,使MVC控制器可以支持依赖注入
            ControllerBuilder.Current.SetControllerFactory(new ResolverControllerFactory().GetControllerFactory());

            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();
        }
 public void IoCInit()
 {
     //初始化IoC
     IoCHelper.InitializeWith(new DependencyResolverFactory());
 }
Beispiel #4
0
        /// <summary>
        /// 网站程序启动事件
        /// </summary>
        /// <remarks>
        ///  2013-11-23 22:33 Created By iceStone
        /// </remarks>
        /// <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 connectionString = new ConnectionString
            //  {
            //      DataSource = Config.GetString("db_server"),
            //      InitialCatalog = Config.GetString("db_name"),
            //      IntegratedSecurity = Config.GetBoolean("db_integrated_auth"),
            //      UserID = Config.GetString("db_user"),
            //      Password = Config.GetString("db_password"),
            //      MinPoolSize = Config.GetInt32("db_min_pool_size"),
            //      MaxPoolSize = Config.GetInt32("db_max_pool_size"),
            //      ConnectTimeout = Config.GetInt32("db_connect_timeout")
            //  };
            //var config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/"); //System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
            //var connStrs = config.ConnectionStrings;
            //connStrs.ConnectionStrings.Remove("MicuaContext");
            //connStrs.ConnectionStrings.Add(new System.Configuration.ConnectionStringSettings("MicuaContext", connectionString.ToString(), Config.GetString("db_provider_name")));
            //config.Save(System.Configuration.ConfigurationSaveMode.Modified);


            // 初始化IoC
            IoCHelper.InitializeWith(new DependencyResolverFactory());

            // 加载全局设置
            try
            {
                Setting.Set("Generator", "WEDN.NET");
                Setting.Set("site_name", "斯通摇滚吧!");
                // Setting.Set("site_theme", "twentytwelve");
                Setting.Set("site_theme", "default");
                Setting.Set("site_description", "又一个WEDN.NET站点");
                Setting.Set("site_icp", "京ICP备14041905号-1");
                Setting.Set("site_copyright", "Copyright © 2014 Wedn.Net. All Rights Reserved.");
                Setting.Set("widget_home_sidebar", string.Empty);

                // Setting.Set(IoCHelper.Resolve<IOptionService>().GetSetting());
            }
            catch (Exception exception)
            {
                LogHelper.WriteErrorLog("MicuaMvc", "Exception", exception);

                // throw;
            }

            // 注册自定义的控制器,使MVC控制器可以支持依赖注入
            ControllerBuilder.Current.SetControllerFactory(new ResolverControllerFactory().GetControllerFactory());

            // 注册所有插件
            PluginBase.RegisterAllPlugins();

            // 注册区域信息
            //AreaRegistration.RegisterAllAreas();

            // 注册WebAPI
            // WebApiConfig.Register(GlobalConfiguration.Configuration);

            // 注册路由
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            // 注册控制器配置
            // ControllerBuilder.Current.RegisterDefaultNamespace();

            // 注册过滤器
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            // 注册捆绑资源
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // 注册模版引擎
            ViewEngineConfig.RegisterViewEngines(ViewEngines.Engines);
        }