コード例 #1
0
        protected override IEngine CreateEngine()
        {
            NinjectServiceContainer.SetKernel(null); // force new kernel
            var engine = new ContentEngine(new NinjectServiceContainer(), EventBroker.Instance, new ContainerConfigurer());

            return(engine);
        }
コード例 #2
0
        protected override IServiceContainer CreateContainer()
        {
            var container = new NinjectServiceContainer();

#if !NetCore
            container.AddExtension(new ServiceBridge.Ninject.Interception.NinjectServiceContainerExtension());
#endif
            return(container);
        }
コード例 #3
0
        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            //var kernel = new StandardKernel(new NinjectSettings() { UseReflectionBasedInjection = true });
            // medium trust - see https://github.com/ninject/ninject.web.mvc/issues/15
            var kernel = new StandardKernel();

//            var kernel = new StandardKernel(new NinjectSettings { LoadExtensions = false });
//            kernel.Load(new Ninject.Web.Mvc.MvcModule());
            kernel.Bind <Func <IKernel> >().ToMethod(ctx => () => new Bootstrapper().Kernel);
            kernel.Bind <IHttpModule>().To <HttpApplicationInitializationHttpModule>();

            RegisterServices(kernel);

            // this will ensure that n2 uses the same kernel
            NinjectServiceContainer.SetKernel(kernel);

            return(kernel);
        }
コード例 #4
0
 public void SetUp()
 {
     NinjectServiceContainer.SetKernel(null); // force new kernel
     container = new NinjectServiceContainer();
 }
コード例 #5
0
 public void SetUp()
 {
     NinjectServiceContainer.SetKernel(null); // force new kernel
     container = new NinjectServiceContainer();
 }