Searching parent WorkItem containers when doing injections

Feb 17, 2010 at 10:46 PM


I'm used to having nested containers when doing injections, and was surprised that the ObjectFactory didn't search parent containers for services and items when building objects. I'm curious why this isn't done. I've modified ObjectFactory do to upward searches to resolve dependencies, and would be happy to post a patch unless there is reasoning why it wasn't done and where it would be more harm than good. Not being chaffed enough yet with the limitations of the Compact Framework, I can't always see why certain things are (not) done, but I've been burned enough to know that reasons exist.

Feb 17, 2010 at 10:52 PM

I didn't do an upward search of the tree probably because I don't personally use nested containers, so I'm not overly familiar with why you would search a child and expect it to find it in the parent.  I typically write code for best perf, but if searching up the tree is something you're used to and find useful, it probably doesn't cause any perf problems (I assume it doesn't search the parent if it finds the object in the child), so by all means, submit the patch and I'll pull it into the next build.