views:

586

answers:

3

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

A: 

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

AaronLS
Thank you for the quick response. What they show is in code, or from another file. I want to manage the configuration in sql and read the data into an xmldocument and then populate the container.
Oh sorry, I mistook "document" to mean file, didn't realize you meant a inmemory XmlDocument. Closest you might get is reading it from SQL and configuring in code, without the XmlDocument. Would be a pain though. I'm searching to see if there are any methods for inmemory config files in general.
AaronLS
I wonder if you might be able to implement a ConfigurationManager class that allows for the use of an XmlDocument.
AaronLS
A: 

Thank you for the effort.

A: 

Hi,

Why don't you save the XMLDocument in some file localy on the machine and then load that XML file in the Unity container.

Unless there is any restriction in saving the XMLdocument i think it would work.

rauts