views:

185

answers:

3

Should I have any concerns about using a IoC/DI Container, specifically ninject, in a windows mobile app using the compact framework 3.5?

+1  A: 

i am using DI with a CF 2.0 project and haven't seen any issues performance-wise. Or any other issues for that matter. But my DI approach is fairly straightforward in that i look for a particular interface in a DLL specified in a config file and then load it. i'm not sure what kind of overhead ninject would introduce on a compact platform.

Paul Sasik
+1  A: 

The OpenNetCf.net group has an IoC for Mobile here http://ioc.codeplex.com/

The main concern is about how much reflection you force the IoC to perform on your app. Reflection is expensive. If you use a little: no problem, if you use a lot, you could have startup issues.

Personally, I use a variation of Ayende's 15 line IoC in my code.

http://ayende.com/Blog/archive/2007/10/20/Building-an-IoC-container-in-15-lines-of-code.aspx

Chris Brandsma
Yes, reflection is the potential killer. I recently added a type cache to the OpenNETCF IoC framework, which significantly improves object load performance after the first of each type, which I noticed improved some things, but as with anything, you have to understand what your code is doing at a low level to know how to avoid problems.
ctacke
+1  A: 

I have tested ninject and has been satisfied with that. I haven't used it in production yet.