Exemplo n.º 1
0
        protected void Application_Start()
        {
            //初始化引擎上下文环境
            EngineContext.Initialize(false);
            //设置依赖项解析器
            var dependencyResolver = new OceanDependencyResolver();

            DependencyResolver.SetResolver(dependencyResolver);
            //移除所有视图引擎
            ViewEngines.Engines.Clear();
            //使用自定义ThemeableRazorViewEngine视图引擎
            ViewEngines.Engines.Add(new ThemeableRazorViewEngine());
            //注册ASP.NET MVC应用程序中的所有区域
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
            ////注册虚拟路径提供者为嵌入式视图
            //var embeddedViewResolver = EngineContext.Current.Resolve<IEmbeddedViewResolver>();
            //var embeddedProvider = new EmbeddedViewVirtualPathProvider(embeddedViewResolver.GetEmbeddedViews());
            //HostingEnvironment.RegisterVirtualPathProvider(embeddedProvider);
            //开始任务调度
            //TaskManager.Instance.Initialize();
            //TaskManager.Instance.Start();
        }
Exemplo n.º 2
0
        protected void Application_Start()
        {
            //初始化引擎上下文环境
            EngineContext.Initialize(false);
            //数据库是否已经安装
            bool databaseInstalled = true;// DataSettingsHelper.DatabaseIsInstalled();
            //设置依赖项解析器
            var dependencyResolver = new OceanDependencyResolver();

            DependencyResolver.SetResolver(dependencyResolver);
            //模型绑定
            ModelBinders.Binders.Add(typeof(BaseOceanModel), new OceanModelBinder());
            //移除所有视图引擎
            if (databaseInstalled)
            {
                ViewEngines.Engines.Clear();
                //使用自定义ThemeableRazorViewEngine视图引擎
                ViewEngines.Engines.Add(new ThemeableRazorViewEngine());
            }
            //添加一些功能默认ModelMetadataProvider之上
            ModelMetadataProviders.Current = new OceanMetadataProvider();
            //注册ASP.NET MVC应用程序中的所有区域
            AreaRegistration.RegisterAllAreas();
            //注册筛选器
            RegisterGlobalFilters(GlobalFilters.Filters);
            //注册路由
            RegisterRoutes(RouteTable.Routes);
            ////注册虚拟路径提供者为嵌入式视图
            //var embeddedViewResolver = EngineContext.Current.Resolve<IEmbeddedViewResolver>();
            //var embeddedProvider = new EmbeddedViewVirtualPathProvider(embeddedViewResolver.GetEmbeddedViews());
            //HostingEnvironment.RegisterVirtualPathProvider(embeddedProvider);
            //开始任务调度
            //TaskManager.Instance.Initialize();
            //TaskManager.Instance.Start();

            #region 初始化消息处理线程
            //初始化消息处理线程
            CometThreadPool.CreateThreads(5);
            #endregion
        }
Exemplo n.º 3
0
        /// <summary>
        /// The application_start.
        /// </summary>
        protected void Application_Start()
        {
            //初始化引擎上下文环境
            EngineContext.Initialize(false);
            //设置依赖项解析器
            var dependencyResolver = new OceanDependencyResolver();

            DependencyResolver.SetResolver(dependencyResolver);
            //移除所有视图引擎
            ViewEngines.Engines.Clear();
            //使用自定义ThemeableRazorViewEngine视图引擎
            ViewEngines.Engines.Add(new ThemeableRazorViewEngine());
            ////安装插件
            //PluginManager.MarkAllPluginsAsUninstalled();
            //var pluginFinder = Ocean.Core.Infrastructure.EngineContext.Current.Resolve<IPluginFinder>();
            //var plugins = pluginFinder.GetPlugins<IPlugin>(false)
            //    .ToList()
            //    .OrderBy(x => x.PluginDescriptor.Group)
            //    .ThenBy(x => x.PluginDescriptor.DisplayOrder)
            //    .ToList();
            //foreach (var plugin in plugins)
            //{
            //    plugin.Install();
            //}

            //注册ASP.NET MVC应用程序中的所有区域
            AreaRegistration.RegisterAllAreas();
            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
            ////注册虚拟路径提供者为嵌入式视图
            //var embeddedViewResolver = EngineContext.Current.Resolve<IEmbeddedViewResolver>();
            //var embeddedProvider = new EmbeddedViewVirtualPathProvider(embeddedViewResolver.GetEmbeddedViews());
            //HostingEnvironment.RegisterVirtualPathProvider(embeddedProvider);
            //开始任务调度
            TaskManager.Instance.Initialize();
            TaskManager.Instance.Start();
        }