I am struggling to find the best place to locate my Ninject configuration \"Modules\" (the place where Type bindings are specified). I hope I am just missing some obvious tr
Ninject does not require that the assemblies are referenced! You can tell the Kernel
to load all modules from the assemblies that match a certain pattern - see the Load()
overloads! Using this mechanism you map the can expose your features as Modules as @Daniel Marbach suggested in the place where each feature is implemented. I do not like these huge modules defining every binding for an assembly. I'd rather have each in a specific small module for a certain feature.
This also allows one to enable/disable/replace implementations without recompilation of the other assemblies (at least in case you have the interfaces in separate assemblies).
So basically you have:
kernel.Load("*.dll")
or similar.The advantage of this is:
I typically create an assembly just for the IOC Container and configuration; That Assembly can then reference all of the other Assemblies and Ninject (or StructureMap in my case). Then the web application just has to reference the IOC assembly and include a couple lines of initialization code that directly use the IOC assembly.
One note however - My IOC assembly does not reference the web assembly (that would introduce a circular reference). Anything that needs to be injected is defined outside of the web assembly, so this is not a concern for me.
I always put Ninject Modules Configuration into separate assembly like Acme.Common and reference to this from Acme.Data, Acme.Domain etc. so there is no circular dependencies, I can always replace Acme.Common after some modifications in registrations without troubles.
The best way to organize your modules is by feature! For example
Have fun!