Using Factory to get Injected objects

Posted by ryudice on Stack Overflow See other posts from Stack Overflow or by ryudice
Published on 2010-05-18T17:02:49Z Indexed on 2010/05/18 17:30 UTC
Read the original article Hit count: 373

Is it good practice to have a Factory method to retrieve injected objects or is it OK to just use the factory method from the DI framework?

I'm using structure map, should I just use ObjectFactory.GetInstance();, or should I create factory class and inside this class call ObjectFactory.GetInstance();? because if I call ObjectFactory.GetInstance(); in my classes I would be creating coupling to the DI framework? sorry if I'm being ignorant, I'm new to this concepts. Thanks!

© Stack Overflow or respective owner

Related posts about structuremap

Related posts about dependency-injection