Reading PRISM & Unity configuration from multiple files

622 views Asked by At
  1. Can we have Unity configuration in file other than app.config file of the application? If yes, how to do it?
  2. Can we combine unity configuration spread across multiple files?
  3. How to define Unity configuration in the XAML file? (PRISM modules can be configured in XAML.)
  4. Is it possible to have custom implementation of the Microsoft.Practices.Unity.Configuration.UnityConfigurationSection configuration reader class?

We are developing a WPF application which should allow other developers (working on various ares of the enterprise app) to register their XAML views (user controls) with our application. And depending on the functionality being used, our product will navigate user to the appropriate form/view. E.g. On click of the "Home" button, user would be navigated to the "Dashboard". But Dashboard may or may not be developed by the core product.

I am using Prism 4.1.

1

There are 1 answers

0
Damian Cherubini On

I believe that pretty much everything you need is explained in the following section of Unity's documentation:

It describes how to load one or several "configurations" into a Unity container from the default configuration file or from several other independent files.

Based on this, I believe you should be able to have a configuration file in each of your modules and load them manually in the Initialize method (or the module classes' constructors). If not, you can always register the corresponding type mappings programatically in the modules too.