Search Results

Search found 2 results on 1 pages for 'l2type'.

Page 1/1 | 1 

  • How to not pass around the container when using IoC in Winforms

    - by L2Type
    I'm new to the world of IoC and having a problem with implementing it in a Winforms application. I have an extremely basic application Winform application that uses MVC, it is one controller that does all the work and a working dialog (obviously with a controller). So I load all my classes in to my IoC container in program.cs and create the main form controller using the container. But this is where I am having problems, I only want to create the working dialog controller when it's used and inside a using statement. At first I passed in the container but I've read this is bad practice and more over the container is a static and I want to unit test this class. So how do you create classes in a unit test friendly way without passing in the container, I was considering the abstract factory pattern but that alone would solve my problem without using the IoC. I'm not using any famous framework, I borrowed a basic one from this blog post http://www.kenegozi.com/Blog/2008/01/17/its-my-turn-to-build-an-ioc-container-in-15-minutes-and-33-lines.aspx How do I do this with IoC? Is this the wrong use for IoC?

    Read the article

1