I'd like to use the EntLib 4.1 in my current project, specifically Unity 1.2 and the VAB. My application is an SaaS application, so I've made a decision to store tenant-specific configuration files in the database, to be loaded on tenant sign-in. These files include the VAB config and Unity config, as well as other tenant-specific settings.
I can't find any practical way to simply use an XML string as my configuration info for the VAB.
I first thought that I'd have to create a custom implementation of IConfigurationSource, but then I realized that I would have to duplicate the parsing logic already present in the FileConfigurationSource class.
The next thought was that I could create a new class that derives from FileConfigurationSource, and just use the new class as a proxy to pass in the config info instead of a string with the file path, but I couldn't see how to override the place where the file is loaded.
I checked out the SqlConfigurationSource QuickStart sample, but that again is not really what I think I need.
Here is the solution that I came up with to solve this issue:
I created a new class, XmlConfigurationSource, that derived from IConfigurationSource:
The XmlValidatorSettings class was sort of the key to get this working. It's a very simple class deriving from ValidationSettings:
To use this code you'll need to reference the EntLib common and validation DLL's. Hope other people benefit from this!