开发者

Unity 2.0 XML configuration possible?

开发者 https://www.devze.com 2023-02-24 00:28 出处:网络
Is it possible to use custom XML to store unity container configuration in my IoC class library project?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消