Ejemplo n.º 1
0
        public void Configuration(IAppBuilder app)
        {
            var kernel = new StandardKernel();
            kernel.Bind<IClockService>().To<ClockService>()
                  .InSingletonScope();

            var resolver = new NinjectDependencyResolver(kernel);

            // This is kind gross but we'll improve it in the future
            kernel.Bind<IHubContext>()
                  .ToConstant(resolver.Resolve<IConnectionManager>()
                                      .GetHubContext<Clock>())
                  .WhenInjectedInto<ClockService>();

            // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888

            app.MapSignalR(new HubConfiguration
            {
                Resolver = resolver
            });
        }
Ejemplo n.º 2
0
        public void Configuration(IAppBuilder app)
        {
            var kernel = new StandardKernel();

            kernel.Bind <IClockService>().To <ClockService>()
            .InSingletonScope();

            var resolver = new NinjectDependencyResolver(kernel);

            // This is kind gross but we'll improve it in the future
            kernel.Bind <IHubContext>()
            .ToConstant(resolver.Resolve <IConnectionManager>()
                        .GetHubContext <Clock>())
            .WhenInjectedInto <ClockService>();

            // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888

            app.MapSignalR(new HubConfiguration
            {
                Resolver = resolver
            });
        }
Ejemplo n.º 3
0
        public void Configuration(IAppBuilder app)
        {
            var kernel   = new StandardKernel();
            var resolver = new NinjectDependencyResolver(kernel);

            kernel.Bind <IClockService>()
            .To <ClockService>()
            .InSingletonScope();

            // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888

            kernel.Bind(typeof(IHubConnectionContext <dynamic>))
            .ToMethod(context =>
                      resolver.Resolve <IConnectionManager>()
                      .GetHubContext <Clock>()
                      .Clients
                      ).WhenInjectedInto <ClockService>();

            var config = new HubConfiguration();

            config.Resolver = resolver;
            ConfigureSignalR(app, config);
        }