The first thing you need to be sure you're doing is executing your binding code within a Ninject module inside of the Load method, which you override.
For example:
public class ApplicationModule : NinjectModule {
public override void Load() {
Bind<IWeapon>().To<Sword>();
// additional bindings continue ...
}
}
The NinjectModule class inherits classes and interfaces that define the Ninject fluent binding syntax thus making the Bind<T>()
method available within the scope of the class. These modules are then passed to the Ninject kernel when the kernel is instantiated:
var kernel = new StandardKernel(new ApplicationModule());
The Load()
method of each module passed to the kernel will then be called and the binding definitions contained within the methods executed.
The example above specifies NinjectModule as the base class; however, this is specific to version 2.0 of Ninject. If you are using Ninject 1.x, your base class will be StandardModule
. In either case, the load method is overriden and binding statements (which are similar in both versions) are issued there.
To further answer your question:
For Ninject 1.x, the required DLL is ninject.core.dll and the namespace that StandardModule is defined in is Ninject.Core.
For Ninhect 2.0, the required DLL is ninject.dll and the the namespace that NinjectModule is defined in is Ninject.Modules.
In both cases, you may need to reference more namespaces depending on how complex your binding statements get -- i.e. if you use contextual bindings or scope your bindings, etc. In the case of Ninject 1.x, you also may need to reference Ninject.Conditions.dll for these more complex cases.
You do not need to reference Castle.Core unless you are using Ninject's interception feature -- which is a 1.x core feature but an extension in version 2.0.
Hope this helps.