how do use Ninject with class libraries I am developing?

Posted by Greg on Stack Overflow See other posts from Stack Overflow or by Greg
Published on 2010-04-24T03:11:21Z Indexed on 2010/04/24 3:13 UTC
Read the original article Hit count: 245

Filed under:

Hi,

If I am working on a class library how do I make use of Ninject here? Ie from the internal class library point of view and also from the client code?

For example:

  • should the class library have it's own IOC set up, or should it always assume the client code will supply?

  • if no (ie it's upto the client to have the IOC in place) then where is the mapping data stored here'. Is this mapping of the class library's functionality to be places in the client?

    have a reusable library that is available, that uses interfaces with classes that use the getInstance concept to create concrete classes for you to use, then in this case would that make sense on the client side to use the IOC container to create instances of these classes? Or is that really applying a double layer of abstraction?

Q2 Or in the cases where I'm building the reusable library myself and want the client to use an IOC container, then in my reusable library would I then dispense with any overhead of having factories or "getInstance" methods to instantiate the classes in the client? (i.e. as the IOC container would do this no?)

© Stack Overflow or respective owner

Related posts about ninject