Freigeben über


C# sample code for interface injection

I read a great article titled "Inversion of Control Containers and the Dependency Injection pattern" written by Martin Fowler. But, as for me the interface injection pattern was a little confusing. I wrote a sample code in C# based on his article, but the sample doesn’t implement a container. I think it will make it easier to understand the pattern itself.

Comments

  • Anonymous
    May 23, 2006
    Hi Young, this technique is one of the foundations of an AOP framework called Spring. Initiated on the Java/J2EE platform, it also exists on .Net : http://www.springframework.net/index.html
  • Anonymous
    May 24, 2006
    If you want to see another example of the IoC/DI pattern in .NET, check out ObjectBuilder from Microsoft Patterns & Practices - it's part of the Composite UI Application Block, and part of Enterprise Library 2.0.  They're also using it in the Smart Client Software Factory, and the Mobile Client Software Factory.

    It's a stunning piece of work, and really brings IoC/DI to a level where anyone can use it.  Well worth the time to check out.
  • Anonymous
    June 11, 2006
    Thanks for the sample