1

I'd like to create a framework that uses IoC without needing any configuration:

So instead of (adjusted from http://www.castleproject.org/container/gettingstarted/part1/code.html):

IWindsorContainer container = new WindsorContainer();
container.AddComponent("someinterface", typeof(ISomeInterface));
ISomeInterface component = (ISomeInterface) container[typeof(ISomeInterface)];
component.DoIt();
container.Release(component);

The container.AddComponent method would not need to be called, as there would have been some initial step that did some 'auto wiring' by looking in a known directory for any dlls containing classes that implemented ISomeComponent and registered them with the WindsorContainer.

I can see that this would be possible to do from scratch, but ideally I'd like not to rewrite this code if there is an open source project out there that has already done it!

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
thatismatt
  • 9,832
  • 10
  • 42
  • 54
  • Why do you want this? What's wrong with using the configuration file? This technique will be hard to maintain IMO. – Gerrie Schenck Feb 27 '09 at 11:03
  • 1
    Surely it is easier to maintain, as you don't have to keep your config files up to date. – thatismatt Feb 27 '09 at 12:06
  • I wanted to do something similar once upon a time, did you end up rolling your own or did you find something out-of-the-box? – Dave Ziegler Jul 08 '13 at 19:31
  • It was just a toy project I was working on, so in the end I just did it all manually by reflection, i.e. without Windsor. If you are interested I can probably dig out the code and post it here as an answer. I wouldn't use it though, as I think there are issues with it, e.g. interface versioning. – thatismatt Jul 09 '13 at 07:49
  • Thanks for the reply, sounds like you ended up in about the same place I did :) – Dave Ziegler Jul 09 '13 at 14:51

0 Answers0