Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Ninject

hmemcpy edited this page · 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)
Something went wrong with that request. Please try again.