Skip to content
This repository was archived by the owner on Jan 3, 2018. It is now read-only.

Ninject

hmemcpy edited this page Feb 9, 2013 · 10 revisions

Ninject supports registrations (or "bindings") either directly on the IKernel instance (typically, StandardKernel), or via Ninject Modules.

Manual Binding

Agent Mulder plugin supports the following binding syntax:

  • Bind/Rebind<TInterface>().To<TType>() - binds the TInterface to a concrete type TType
  • Bind/Rebind(typeof(TInterface)).To(typeof(TType)) - non generic overloads, same as above
  • Bind/Rebind<TType>().ToSelf() - binds the concrete TType to itself.

You can also mix and match between the generic and non-generic overloads.

Open generic types are supported using the non-generic overloads:

  • Bind(typeof(IRepository<>)).To(typeof(NHRepository<>))

Not (yet?) supported

  • Ninject v3 syntax
  • Scan() from Ninject.Extensions.Conventions
  • Bind<T1...Tn>() - overloads with more than one generic parameter
  • Rebind<T1...Tn>()
  • ToProvider()
  • When*
  • Convention-based binding (kernel.Load)

Clone this wiki locally