예제 #1
0
        public static IKernel Instance()
        {
            var kernel = new StandardKernel();

            try
            {
                NinjectWebContainer.Container(kernel);

                return(kernel);
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
예제 #2
0
        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;
            }
        }