Is it possible to configure ms Unity container from an xml document and NOT from a file?
2 回答
Not sure about that, but you can configure programmatically without a .config, so you could have your own xml file, read settings and programmatically setup your Unity container. It's ashame this facet isn't covered in alot of the documentation. There are alot of scenarios where the App.config isn't available or appropriate.
Edit:
By default, this is the App.config or Web.config file for your application. However, you can load configuration information from any other XML format file or from other sources.
为什么不将 XMLDocument 保存在机器上的某个本地文件中,然后将该 XML 文件加载到 Unity 容器中。
除非保存 XML 文档有任何限制,否则我认为它会起作用。