protected override IKernel CreateKernel() { var kernel = new StandardKernel(); NinjectModule[] modules = new NinjectModule[] { new WebModule() }; kernel.Load(Assembly.GetExecutingAssembly()); kernel.Load(modules); return kernel; }
/// <summary> /// Creates the kernel that will manage your application. /// </summary> /// <returns>The created kernel.</returns> protected override Ninject.IKernel CreateKernel() { INinjectModule[] modules = new NinjectModule[] { new __NAME__Module() }; return new StandardKernel(modules); }
public ApplicationController(NinjectModule viewModule, NinjectModule coreModule) : base(viewModule, coreModule) { Kernel.Bind<ApplicationControllerBase>().ToConstant<ApplicationController>(this); this.MainWindow = new FormCSMMain(this); this.WindowPresenter.ShowHomeLayout(); }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { NinjectModule[] modules = new NinjectModule[] { new WebModule(), }; kernel.Load(modules); }
/// <summary> /// Creates the kernel that will manage your application. /// </summary> /// <returns>The created kernel.</returns> private static IKernel CreateKernel() { var modules = new NinjectModule[] { new TestBindModule() }; var kernel = new StandardKernel(modules); RegisterServices(kernel); return kernel; }
protected override IKernel CreateKernel() { var modules = new NinjectModule[] { new MembershipModule(), new ServiceModule() }; var kernel = new StandardKernel(modules); kernel.Load(Assembly.GetExecutingAssembly()); GlobalConfiguration.Configuration.DependencyResolver = new NinjectDependencyResolver(kernel); return kernel; }
public static void LoadModules(IKernel kernel) { var modules = new NinjectModule[] { new DatabaseModule(), new CacheModule(), new ServiceModule(), new RepositoryModule() }; kernel.Load(modules); }
/// <summary> /// Creates the kernel that will manage your application. /// </summary> /// <returns>The created kernel.</returns> private static IKernel CreateKernel() { var modules = new NinjectModule[] { new TaskRegisterModule(), new MetadataProviderModule(), new MvcDIModule() }; var kernel = new StandardKernel(modules); kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel); kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>(); //Support WebAPI GlobalConfiguration.Configuration.DependencyResolver = new NinjectResolver(kernel); RegisterServices(kernel); return kernel; }
/// <summary> /// Creates the kernel that will manage your application. /// </summary> /// <returns>The created kernel.</returns> private static IKernel CreateKernel() { var modules = new NinjectModule[] {new BLLNinjectModule()}; var kernel = new StandardKernel(modules); try { kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel); kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>(); RegisterServices(kernel); return kernel; } catch { kernel.Dispose(); throw; } }
/// <summary> /// Load your modules or register your services here! /// </summary> /// <param name="kernel">The kernel.</param> private static void RegisterServices(IKernel kernel) { // You can swap out modules for different implementations // because it is designed with an abstraction layer var modules = new NinjectModule[] { new FluentValidatorModule(), new EntityFrameworkModule(), // new NHibernateModule(), needs more work done }; kernel.Load(modules); // These modules define the interfaces to be injected // Ninject will handle the object lifetime // This means it will create new or inject current instances from its container into // anything that consumes a defined interface and annotated with [Inject] // https://github.com/ninject/ninject.web.mvc.fluentvalidation // FluentValidation plugin goes well NinjectValidatorFactory ninjectValidatorFactory = new NinjectValidatorFactory(kernel); ModelValidatorProviders.Providers.Add(new FluentValidationModelValidatorProvider(ninjectValidatorFactory)); DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false; }
public override void Load(NinjectModule module) { module.Bind<Samurai>().ToSelf(); }
public void LoadBindings(NinjectModule module) { }
public ServiceLocatorBindings(NinjectModule module) { _module = module; }
public static MortgageModellingService GetModellingService(NinjectModule bindings) { IKernel kernel = new StandardKernel(bindings); return kernel.Get < MortgageModellingService>(); }
public void LoadBindings(NinjectModule module) { module.Bind<ISplashLogic>().To<SplashLogic>().InSingletonScope(); }
public void LoadBindings(NinjectModule module) { module.Bind<IMetaDataLogic>().To<MetaDataLogic>().InSingletonScope(); module.Bind<IMetaDataScriptedFragment>().To<MetaDataScriptedFragment>().InSingletonScope(); }
public abstract void Load(NinjectModule module);
public void LoadBindings(NinjectModule module) { module.Rebind<ILastReadPostDataProvider>().To<LastReadPostDataProvider>().InSingletonScope(); module.Rebind<ILastReadPostLogic>().To<LastReadPost>().InSingletonScope(); module.Rebind<ILastReadPostScriptedFragment>().To<LastReadPostScriptedFragment>().InSingletonScope(); }
internal Startup(NinjectModule module) { m_Module = module; }
public override void Load(NinjectModule module) { module.Bind<IWeapon>().To<Sword>(); }
public ServiceLocatorBindings(NinjectModule registrationModule) { _registrationModule = registrationModule; }
public void LoadBindings(NinjectModule module) { module.Bind<IEmoticonLogic>().To<EmoticonLogic>().InSingletonScope(); }
public override void Load(NinjectModule module) { LoadExecuted = true; }
public override void Load(NinjectModule module) { module.Bind<IWeapon>().To<BareHands>(); }
public ApplicationKernel(NinjectModule module) { Kernel = new StandardKernel(module); }
public override void Load(NinjectModule module) { }
/// <summary> /// Add a new module. /// </summary> /// <param name="ninjectModule"> /// The module. /// </param> public void AddModule(NinjectModule ninjectModule) { this.modules.Add(ninjectModule); }
/// <summary> /// Unregisters the provided module from the dependency loader. /// </summary> /// <param name="module"></param> /// <returns></returns> public DependancyBinder UnregisterModule(NinjectModule module) { if (this.Modules.Contains(module)) { this.Modules.Remove(module); } return this; }
public void LoadBindings(NinjectModule module) { module.Bind<IUserHealth>().To<UserHealth>(); }
public void LoadBindings(NinjectModule module) { module.Rebind<IContentLogic>().To<ContentLogic>().InSingletonScope(); }