コード例 #1
0
ファイル: Startup.cs プロジェクト: andreyskv/chessrock
        public void Configuration(IAppBuilder app)
        {
            //Configure AutoMapper (http://automapper.codeplex.com/)
            Mapper.Initialize(ConfigureMapper);

            //Configure Bearer Authentication
            OAuthOptions = new OAuthAuthorizationServerOptions();
            app.UseOAuthBearerTokens(OAuthOptions);

            //Configure AutoFac for DependencyResolver (http://autofac.org/)
            IContainer container = RegisterServices();
            var resolverForSignalr = new Autofac.Integration.SignalR.AutofacDependencyResolver(container);
            var resolver = new App.Common.AutoFacDependencyResolver(container);

            //Configure WebApi
            var config = new HttpConfiguration() { DependencyResolver = resolver };
            ConfigureWebApi(config);
            app.UseWebApi(config);

            //Configure SignalR self host
            var hubConfiguration = new HubConfiguration() { Resolver = resolverForSignalr };
            app.MapSignalR(hubConfiguration);

            //Log trafic using Log4Net
            app.Use(typeof(Logging));

            // container.Resolve<IRavenRepository>();

            //Set global dependency resolver for signalr
            GlobalHost.DependencyResolver = resolverForSignalr;
        }
コード例 #2
0
        public void Configuration(IAppBuilder app)
        {
            //Configure AutoMapper (http://automapper.codeplex.com/)
            Mapper.Initialize(ConfigureMapper);

            //Configure Bearer Authentication
            OAuthOptions = new OAuthAuthorizationServerOptions();
            app.UseOAuthBearerTokens(OAuthOptions);

            //Configure AutoFac for DependencyResolver (http://autofac.org/)
            IContainer container          = RegisterServices();
            var        resolverForSignalr = new Autofac.Integration.SignalR.AutofacDependencyResolver(container);
            var        resolver           = new App.Common.AutoFacDependencyResolver(container);

            //Configure WebApi
            var config = new HttpConfiguration()
            {
                DependencyResolver = resolver
            };

            ConfigureWebApi(config);
            app.UseWebApi(config);

            //Configure SignalR self host
            var hubConfiguration = new HubConfiguration()
            {
                Resolver = resolverForSignalr
            };

            app.MapSignalR(hubConfiguration);

            //Log trafic using Log4Net
            app.Use(typeof(Logging));

            // container.Resolve<IRavenRepository>();

            //Set global dependency resolver for signalr
            GlobalHost.DependencyResolver = resolverForSignalr;
        }