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 FileNotFoundExc eption
thrown for ....\TestApplic ation.exe.confi g
when executing:
>>>> Hashtable configdata =new Hashtable();
configdata["ConnectionStri ng"]="Provider=MSDA ORA....";
ConfigurationMa nager.Write(con figdata);>>>>>
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 ConfigSectionHa ndler:
_xmlAppConfigDo c.Load(
AppDomain.Curre ntDomain.SetupI nformation.Conf igurationFile );
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="applicati onConfiguration Management" type="..." />
<section name="TheRegist ry"
type="...Hashta bleSectionHandl er,...."/>
</configSections>
<!-- Configuration Management Application Block -->
<applicationCon figurationManag ement defaultSection= "TheRegistr y">
<configSectio n name="TheRegist ry">
<configProvid er assembly="..." type="....Regis tryStorage"
registryRoot="L ocalMachine" registrySubKey= "Software\MyCla ssLib"/>
</configSection>
</applicationConf igurationManage ment>