Esempio n. 1
0
        public void Configuration(IAppBuilder app)
        {
            // 有关如何配置应用程序的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkID=316888
            ICacheProvider provider = new RuntimeMemoryCacheProvider();

            CacheManager.SetProvider(provider, CacheLevel.First);

            IServicesBuilder   builder  = new ServicesBuilder();
            IServiceCollection services = builder.Build();

            services.AddLog4NetServices();
            services.AddDataServices();
            services.AddAutoMapperServices();
            services.AddOAuthServices();
            services.AddSolutionServices(app);
            //services.AddCommunicationService();

            IIocBuilder mvcIocBuilder = new MvcAutofacIocBuilder(services);

            app.UseOsharpMvc(mvcIocBuilder);
            IIocBuilder apiIocBuilder = new WebApiAutofacIocBuilder(services);

            app.UseOsharpWebApi(apiIocBuilder);
            //app.UseOsharpSignalR(new SignalRAutofacIocBuilder(services));

            app.ConfigureOAuth(apiIocBuilder.ServiceProvider);
            app.ConfigureWebApi();
            //app.ConfigureSignalR();

            IIocBuilder hangfireBuilder = new HangfireAutofacIocBuilder(services);

            app.UseOSharpHangfile(hangfireBuilder);
            GlobalConfiguration.Configuration.UseMemoryStorage();
            app.UseHangfireDashboard();
            app.UseHangfireServer(new BackgroundJobServerOptions()
            {
                WorkerCount = 1
            });
            HangfireJobsRunner.Start();

            //启动Communication服务
            //IServiceProvider serviceProvider = apiIocBuilder.Build();
            //ICommunicationContract communicationContracts = serviceProvider.GetService<ICommunicationContract>();
            //if (communicationContracts != null)
            //{
            //    communicationContracts.Initialize();
            //}
        }
Esempio n. 2
0
        public void Configuration(IAppBuilder app)
        {
            // 有关如何配置应用程序的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkID=316888
            ICacheProvider provider = new RuntimeMemoryCacheProvider();

            CacheManager.SetProvider(provider, CacheLevel.First);

            IServicesBuilder   builder  = new ServicesBuilder();
            IServiceCollection services = builder.Build();

            services.AddLog4NetServices();
            services.AddDataServices();
            services.AddAutoMapperServices();
            services.AddOAuthServices();

            //加载TG.UBP的接口服务,主要包括基础设施层、领域层和应用层
            services.AddUBPUtilityServices(app);
            services.AddUBPCoreServices(app);
            //services.AddUBPApplicationServices(app);

            IIocBuilder mvcIocBuilder = new MvcAutofacIocBuilder(services);

            app.UseOsharpMvc(mvcIocBuilder);
            IIocBuilder apiIocBuilder = new WebApiAutofacIocBuilder(services);

            app.UseOsharpWebApi(apiIocBuilder);
            //app.UseOsharpSignalR(new SignalRAutofacIocBuilder(services));

            app.ConfigureOAuth(apiIocBuilder.ServiceProvider);
            app.ConfigureWebApi();
            //app.ConfigureSignalR();

            IIocBuilder hangfireBuilder = new HangfireAutofacIocBuilder(services);

            app.UseOSharpHangfile(hangfireBuilder);
            GlobalConfiguration.Configuration.UseMemoryStorage();
            app.UseHangfireDashboard();
            app.UseHangfireServer(new BackgroundJobServerOptions()
            {
                WorkerCount = 1
            });
            HangfireJobsRunner.Start();
        }