UserSettings and WPF/Prism/Unity

Topics: Prism v4 - WPF 4
Aug 9, 2012 at 4:33 PM

I am just getting started using Prism and Unity to develop a modular application. I am trying to figure out how I can have user settings accessed/set from various modules to a central repository of some sort.

I have my 'core' application and then various modules added to that. What I could like to do is pass the user settings from the app.config from my core app to the various modules if they need it.

Any help would be greatly appreciated.

Developer
Aug 9, 2012 at 6:48 PM

Hi,

Based on my understanding of your scenario, I believe you could use a Shared Service to expose information that needs to be shared across your different modules. As you may find, a Shared Service is a class registered in the container that can be accessed through a common interface. This way, in your service you could define the logic to access and store the information according to your needs.

You could find more information about shared services in the following chapter of the Prism documentation:

Also, for a example that implements a Shared Service, you could check the OrdersRepository.cs in the Commanding Quickstart provided with Prism.

Additionally, I believe you could also check the Dependency Injection Lab of the Prism Training Kit, which explains step by step how to register and consume shared services using the Unity container. Although the samples in this Lab use Silverlight, I believe the concepts explained will still be useful.

I hope you find this helpful,

Agustin Adami
http://blogs.southworks.net/aadami

Aug 10, 2012 at 8:21 PM

Thank you, those resources were useful.