Jul 31, 2011 at 7:56 PM
Edited Aug 1, 2011 at 1:03 AM
I figured out my issue, EnterpriseLibraryContainer.ConfigureContainer(...) does not set EnterpriseLibraryContainer.Current. When I was using the ValidationFactory<T> and PropertyValidationFactory, these methods were creating a new UnityContainer and
thus my configuration was not present. In my UnityBootstrapper I set EnterpriseLibraryContainer.Current and the factories work as expected.
This is the code for loading and configuring validation with an existing container.
var streamInfo = Application.GetResourceStream(new Uri("Validation.xaml", UriKind.Relative));
var streamReader = new StreamReader(streamInfo.Stream);
var configDictionary = (IDictionary)XamlReader.Load(streamReader.ReadToEnd());
var configSource = DictionaryConfigurationSource.FromDictionary(configDictionary);
var containerConfigurator = new UnityContainerConfigurator(this.UnityContainer);
Should EnterpriseLibraryContainer.ConfigureContainer set the Current container for me?
Does the Developers Guide have guidance on using an existing container?