/// <summary>
 /// 初始化Mvc框架
 /// </summary>
 public static IAppBuilder UseMvcInitialize(this IAppBuilder app, MvcInitializeOptions options)
 {
     options.CheckNotNull("options");
     IFrameworkInitializer initializer = new MvcFrameworkInitializer(options);
     initializer.Initialize();
     return app;
 }
Exemple #2
0
        private static void Initialize()
        {
            ICacheProvider provider = new RuntimeMemoryCacheProvider();
            CacheManager.SetProvider(provider, CacheLevel.First);

            //MVC初始化
            IFrameworkInitializer initializer = new MvcFrameworkInitializer()
            {
                BasicLoggingInitializer = new Log4NetLoggingInitializer(),
                IocInitializer = new MvcAutofacIocInitializer()
            };
            initializer.Initialize();

            //WebApi初始化
            initializer = new WebApiFrameworkInitializer()
            {
                BasicLoggingInitializer = new Log4NetLoggingInitializer(),
                IocInitializer = new WebApiAutofacIocInitializer()
            };
            initializer.Initialize();

            ////SignalR
            //initializer = new SignalRFrameworkInitializer()
            //{
            //    BasicLoggingInitializer = new Log4NetLoggingInitializer(),
            //    IocInitializer = new SignalRAutofacIocInitializer()
            //};
            //initializer.Initialize();
        }
        /// <summary>
        /// 初始化Mvc框架
        /// </summary>
        public static IAppBuilder UseMvcInitialize(this IAppBuilder app, MvcInitializeOptions options)
        {
            options.CheckNotNull("options");
            IFrameworkInitializer initializer = new MvcFrameworkInitializer(options);

            initializer.Initialize();
            return(app);
        }
Exemple #4
0
        private static void Initialize()
        {
            ICacheProvider provider = new RuntimeMemoryCacheProvider();
            CacheManager.SetProvider(provider, CacheLevel.First);

            IBasicLoggingInitializer loggingInitializer = new Log4NetLoggingInitializer();
            //Mvc初始化
            MvcInitializeOptions mvcOptions = new MvcInitializeOptions(loggingInitializer, new MvcAutofacIocInitializer());
            IFrameworkInitializer initializer = new MvcFrameworkInitializer(mvcOptions);
            initializer.Initialize();

            //WebApi初始化
            WebApiInitializeOptions apiOptions = new WebApiInitializeOptions(loggingInitializer, new WebApiAutofacIocInitializer());
            initializer = new WebApiFrameworkInitializer(apiOptions);
            initializer.Initialize();

            ////SignalR初始化
            //SignalRInitializeOptions signalrOptions = new SignalRInitializeOptions(loggingInitializer, new SignalRAutofacIocInitializer());
            //initializer = new SignalRFrameworkInitializer(signalrOptions);
            //initializer.Initialize();
        }