Misleading for newbies that RI is not using ServiceLocator

Topics: Prism v2 - Silverlight 2, Prism v2 - WPF 3.5
Feb 19, 2009 at 11:21 PM
Nice release with the 2.0!

I checked out the RI and saw that IUnityContainer in constructors everywhere (16 classes).

This is a little bit misleading for newbies who are reading thru all the tech docs and patterns related to Composite WPF.

Maybe you should update the RI to use IServiceLocator instead of IUnityContainer.

What is you opinion?

If you make this change is someone like to have an app tested for a different IOC container then the RI is there for him :-)

Feb 20, 2009 at 1:22 PM
Edited Feb 20, 2009 at 1:24 PM

Hi Attila


The IServiceLocator is not meant to be the general-purpose container. Containers have different semantics of usage, which often drives the decision for why that container is chosen. Bearing this in mind, the Stock Trader RI uses Unity directly instead of using the IServiceLocator. This is the recommend approach for your application development.


In the following situations, it may be appropriate for you to use the IServiceLocator:

·         You are an independent software vendor (ISV) designing a third-party service that needs to support multiple containers.

·         You are designing a service to be used in an organization where they use multiple containers.


Perhaps you may find useful the following related article in the documentation.

·         Container and Services


Please let me know if this helps.


Mariano Converti


Feb 20, 2009 at 2:09 PM
Hi Mariano!

Yep I recall that I read these guidelines during the read-thru of CAL docs and blogs.

From this point of view it makes sense, no offense here :-)

But it still stands that if someone (an ISV for example) like to test his own container with a real app, the RI should be a great help from out of the box.