4

Is it possible to configure ms Unity container from an xml document and NOT from a file?

4

2 回答 2

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.

See: http://msdn.microsoft.com/en-us/library/cc440941.aspx

于 2009-04-07T00:37:02.840 回答
1

为什么不将 XMLDocument 保存在机器上的某个本地文件中,然后将该 XML 文件加载到 Unity 容器中。

除非保存 XML 文档有任何限制,否则我认为它会起作用。

于 2009-09-25T09:08:34.683 回答