Unity 2.0 XML configuration possible?
Is it possible to use custom XML to store unity container configuration in my IoC class library project?
I dont want to sto开发者_如何学编程re the IoC config at the startup project (WPF project).
Regards Bryan
You can use ConfigurationManager.OpenMappedExeConfiguration to load an arbitrary file, but you'll need to do that yourself - the simpler overloads will go to the appdomain's config file by default.
If you have the Unity source code, you can look in the Unity\Tests\TestSupport.Unity\Configuration\ConfigFileLoader.cs file for an (perhap overly complex) example. There we pull a config file out of a resource, dump it to disk, and then load it via ConfigurationManager.
精彩评论