Tuesday, March 03, 2009

IoC framework for the Compact Framework

Andy Wigley mentioned the other day the p&p team has released a series of blocks for the Compact Framework including a dependency injection framework called ContainerModel. So I decided to have a look.

You can get the code from codeplex here: http://www.codeplex.com/Mobile

It is based on the MCSF but for .NET CF 3.5.

I have had a look at the IoC framework and it is pretty good but would be even better if it had support for configuration files (XML). So currently you have to code something like this:
c => new EditCustomersView())
(c, v) => v.Presenter = c.Resolve<EditCustomersPresenter>());
Then you can code this:
var view = ApplicationRoot.Container.Resolve<IEditCustomersView>();
This is a first cut so maybe we will see support for configuration files in the future. If I get time I'll add support for it.

It's quite cool as you can pass in an Action delegate at the time of register to instantiate the class.


Anonymous said...

Hy Simon
Ctacke just made a blog post about IoC too. See:


and the interesting proposition from Filip:


Have fun

Simon Hart said...

Thanks for that Daniel!.


Anonymous said...

If factg we now have our framework up in CodePlex too: