I read a few things around on this site :
I use Ninject. If I understand these recommendations, it is necessary that:
That seems strange, especially for factories. I have many projects that use the same library. Should all these projects redefine ninject modules and factories?
What do you think ?
The configuration does not necessarily be in the application assembly. It can also be in several dedicated assembly containing nothing than a part of the configuration. But as you mentioned it shouldn't be part of the implementation. In case you share exactly the same configuration over several projects you can reference an existing one.
For factories you can use Ninject.Extensions.Factory
in the future so that you don't have to implement them yourself.
This depends a lot on the context of your libraries, how I do it is:
Initialize everything in a Bootstrapper in the main project. Although I have several levels of bootstrappers where I configure different things (mainly because I use my libraries in the same kind of projects, so they have similar configuration)
To keep this abstracted from the Ioc framework, I use the ServiceLocator pattern
which you could use in your factories.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With