/// <summary> /// Creates the kernel that will manage your application. /// </summary> /// <returns>The created kernel.</returns> private static IKernel CreateKernel() { var kernel = new StandardKernel(); kernel.Bind <Func <IKernel> >().ToMethod(ctx => () => new Bootstrapper().Kernel); kernel.Bind <IHttpModule>().To <HttpApplicationInitializationHttpModule>(); RegisterServices(kernel); var resolver = new NinjectResolver(kernel); // for ASP.NET controllers GlobalConfiguration.Configuration.DependencyResolver = resolver; // for Web API controllers DependencyResolver.SetResolver(resolver); return(kernel); }
/// <summary> /// Creates the kernel that will manage your application. /// </summary> /// <returns>The created kernel.</returns> private static IKernel CreateKernel() { var kernel = new StandardKernel(); kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel); kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>(); RegisterServices(kernel); var resolver = new NinjectResolver(kernel); // for ASP.NET controllers GlobalConfiguration.Configuration.DependencyResolver = resolver; // for Web API controllers DependencyResolver.SetResolver(resolver); return kernel; }