예제 #1
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();
        }
예제 #2
0
 /// <summary>
 /// 初始化WebApi框架
 /// </summary>
 public static IAppBuilder UseWebApiInitialize(this IAppBuilder app, WebApiInitializeOptions options)
 {
     app.CheckNotNull("app");
     options.CheckNotNull("options");
     IFrameworkInitializer initializer = new WebApiFrameworkInitializer(options);
     initializer.Initialize();
     return app;
 }
예제 #3
0
        /// <summary>
        /// 初始化WebApi框架
        /// </summary>
        public static IAppBuilder UseWebApiInitialize(this IAppBuilder app, WebApiInitializeOptions options)
        {
            app.CheckNotNull("app");
            options.CheckNotNull("options");
            IFrameworkInitializer initializer = new WebApiFrameworkInitializer(options);

            initializer.Initialize();
            return(app);
        }
예제 #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();
        }