0

I have read this Code your own IOC Container and searched the internet on creating an own ioc container. I don't understand any of the "simple" examples because it's flooded with jargons (why use "resolve" instead of just create method ?) and none shows an example without ioc and refactor it to iOC.

So can someone does something like that in less than 50 lines of code if possible ?

Community
  • 1
  • 1
user310291
  • 36,946
  • 82
  • 271
  • 487
  • 1
    out of curiosity, why do you want to re-invent the wheel? (and a wheel that is quite complex, and made simple by a lot of providers) – RPM1984 Oct 24 '10 at 09:13
  • Ayende's example is in one of the answers, but here's the link: http://ayende.com/Blog/archive/2007/10/20/Building-an-IoC-container-in-15-lines-of-code.aspx – Amittai Shapira Oct 24 '10 at 09:48

2 Answers2

2

Here: Building an IoC container in 15 lines of code and Dependency Injection doesn't cut it anymore.

jason
  • 236,483
  • 35
  • 423
  • 525
1

My suggestion is - don't build your own.

There are literally dozens of lightweight and popular containers out there with lots of support. If you build it yourself, you support it yourself. Personally I find Microsoft Unity more than enough for most of my needs, it's supported in both .NET and Silverlight, and quite importantly it's got "Microsoft" in front of it to make management happy.

Doobi
  • 4,844
  • 1
  • 22
  • 17