public static IKernel Instance() { var kernel = new StandardKernel(); try { NinjectWebContainer.Container(kernel); return(kernel); } catch { kernel.Dispose(); throw; } }
private static IKernel CreateKernel() { var kernel = new StandardKernel(); try { kernel.Bind <Func <IKernel> >().ToMethod(ctx => () => new Bootstrapper().Kernel); kernel.Bind <IHttpModule>().To <HttpApplicationInitializationHttpModule>(); NinjectWebContainer.Container(kernel); return(kernel); } catch { kernel.Dispose(); throw; } }