I want to use the CMAB to retrieve configuration details for a class
library. More particular, I'm developping a Data Access Layer in class
libraries, with later on BL, allowing any application (as a Presentation
Layer) to access the business logic of the class library.
I'd like to store essential configuration details (connection strings,
environement settings) in the machine.config file, allowing the
DEV/TEST/PROD system only to differ in machine.config file.
When using the out of the box functionality, I get a FileNotFoundException
thrown for ....\TestApplication.exe.config
when executing:
>>>> Hashtable configdata =new Hashtable();
configdata["ConnectionString"]="Provider=MSDAORA....";
ConfigurationManager.Write(configdata);>>>>>
What does this indicate? Invalid/unsufficient configuration data
Any suggestions would be very appreciated, cause I don't seem to find the
cause. Looking into the code indicates that this file is tried to be read in
a ConfigSectionHandler:
_xmlAppConfigDoc.Load(
AppDomain.CurrentDomain.SetupInformation.Configura tionFile );
But It's never indicated the file should exist. When I try to create the
file manually, it gets delete at program startup.
Kind regards,
Mattias
machine.confg excerpt:
....
<section name="applicationConfigurationManagement" type="..." />
<section name="TheRegistry"
type="...HashtableSectionHandler,...."/>
</configSections>
<!-- Configuration Management Application Block -->
<applicationConfigurationManagement defaultSection="TheRegistry">
<configSection name="TheRegistry">
<configProvider assembly="..." type="....RegistryStorage"
registryRoot="LocalMachine" registrySubKey="Software\MyClassLib"/>
</configSection>
</applicationConfigurationManagement>