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> /// 初始化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; }
/// <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); }
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(); }