Silverlight Integration Pack and Prism

Topics: Silverlight Integration Pack
May 10, 2011 at 4:56 PM
Edited May 10, 2011 at 6:18 PM

Would it be possible to provide an example of how to integrate the Silverlight application blocks (Caching, Logging, Exception Handling) with the Prism framework?  Specifically, how to use ensure both the Prism library and Enterprise library are using the same UnityContainer objects.  I have been receiving errors on the Prism side when trying to use both technologies in the same application, and I have a feeling that the issue is that two UnityContainers are in play.


- Actually I was able to do this by simply using IUnityContainer for all views and view models that were registered under the Container, and use EnterpriseLibraryContainer.Current.GetInstance<>() for all "enterprise-related" objects.

For example, in a LoggingServiceAgent class, you can simply use EnterpriseLibraryContainer.Current.GetInstance<LogWriter>() in the body of the constructor (rather than asking for it as a construction parameter).

May 11, 2011 at 2:49 AM


I'm not familiar yet with both techonology but I can recommend you to take a look on the sample solution sent by gan_s in this thread. It uses the Silverlight Integration, Prism and Caching. Hope this helps :)


Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.

May 12, 2011 at 1:44 AM
Edited May 12, 2011 at 1:48 AM

Hi there.  Thank you for your reply.

I downloaded and reviewed the project you mentioned, however this did not help.

What I would like to do is use the UnityContainer from PRISM along with EnterpriseLibraryContainer.Current, but have them reference the same container (through the Service Locator).

I have tried the following in the Bootstrapper, but it just throws an error when trying to resolve MainPage:



protected override DependencyObject CreateShell()
  EnterpriseLibraryContainer.Current = new UnityServiceLocator 

var mainPage = EnterpriseLibraryContainer.Current.GetInstance<MainPage>); 
Application.Current.RootVisual = mainPage;

  return mainPage as DependencyObject;



Any help would be greatly appreciated.

Thank you.



May 13, 2011 at 8:39 AM

I'm afraid as far as we know there haven't had yet a lot of samples out for the silverlight integration. As for your problem, personally I haven't work with Prism yet so could you be able to simplify/elaborate more your problem. Thanks.

Gino Terrado
Global Technologies and Solutions
Avanade, Inc.

Sep 1, 2011 at 10:47 PM

Does now anybody has experience with PRISM and the EntLib?
How should I configure the bootstrapper.
This should to be a common problem, since the use of PRISM and the EntLib under WPF and Silverlight is obviously.


Sep 2, 2011 at 4:36 AM


You can also try to ask this over Prism Forum ( to get a wider audience.


Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
Contact Us

Sep 13, 2011 at 4:56 PM

I haven't done this myself since I use an MEF container with Prism... but you should be able to override the ConfigureContainer method of the UnityBootstrapper class to register the Enterprise Library with the Prism Unity container.

The MSDN documentation may also be helpful here...