Help us improve the OpenNETCF IOC Framework

Coordinator
Mar 19, 2009 at 5:07 PM
Help us improve the framework by giving us feedback.

How did you find out about the framework?

If you're using the framework, let us know!  What features do you find most useful?  What could be improved?

If you looked at it and then decided not to use it, let us know why.  Was it missing some feature?  Not understandable?

Apr 2, 2009 at 2:50 PM
Edited Apr 2, 2009 at 2:51 PM
Hi Chris.

 I am interested in using your IoC library and have played around with it a bit.

 I was wondering if you plan to implement the following feature (C#):

 RootWorkItem.Items.AddNew<IFoo>(typeof(Foo));

 And then we can retrieve the concrete type for the interface as follows:

                 IFoo f = RootWorkItem.Items[typeof(IFoo)]

 Are there any pitfalls that you know of for this particular feature.

 I want this behaviour so I can easily change the implementation class for the interface

Without littering my code with factories.

 Thnx

 Kind Regards

 Rouan.

Coordinator
Apr 2, 2009 at 2:54 PM

The problem with this is that the Items collection can contain 0-n items of any particular type, so RootWorkItem.Items[typeof(IFoo)] would have to return an array, not a single item.  If you only need one of the item, the Services collection already does exactly this:

 

RootWorkItem.Services.AddNew<Foo, IFoo>();

IFoo item = RootWorkItem.Services.Get<IFoo>();

 

If getting back a collection is OK, then the Items collection already can do it this way (with code I checked in yesterday).

 

Foo foo = new Foo;

RootWorkItem.Items.Add(foo);

RootWorkItem.Items.FindByType<IFoo>();