Mark Pearl


Self bindings declare a binding of a certain type to itself. Self bindings are not needed for types which have a parameterless constructor. Ninject can instantiate these types on its own. If you declare a self binding. t is only possible to do a Get. For example Get would throw an ActivationException.

For example you can do the following:


Method bindings allow you to specify a method which is responsible to create an instance of the binded type.

For example you can do the following:

Bind<ISword>().ToMethod(() => new Sword(strength = 12)); 


The Mother Ship
S/O Question

blog comments powered by Disqus

Want to get my personal insights on what I learn as I learn it? Subscribe now!