CMAB and standard section handlers

R

R. Raghuraman

Hi,
Q1: Do the section handlers in .NET work with CMAB? The CMAB seems to
say so, but I am not sure.

Q2: I am having trouble using CMAB with the standard section handler -
I've been able to use CMAB with the HashtableSectionHandler. However,
when I try to replace this with DictionarySectionHandler, I get a null
reference exception:

See below for App.config file and the referenced config file.


Unhandled Exception: System.TypeInitializationException: The type
initializer for "LNUK.Framework.Co
mmon.DBWrapper" threw an exception. --->
System.NullReferenceException: Object reference not set to
an instance of an object.
at System.Configuration.HandlerBase.CheckForUnrecognizedAttributes(XmlNode
node)
at System.Configuration.DictionarySectionHandler.Create(Object
parent, Object context, XmlNode se
ction)
at Microsoft.ApplicationBlocks.ConfigurationManagement.ConfigurationManager.Read(String
sectionNa
me) in C:\Program Files\Microsoft Application Blocks for
..NET\Configuration Management\Code\VB\Micro
soft.ApplicationBlocks.ConfigurationManagement\ConfigurationManager.vb:line
164
at LNUK.Framework.Common.DBWrapper..cctor() in
C:\Raghu\Codebase\DatabaseWrapper\DatabaseWrapper\
DBWrapper.vb:line 149
--- End of inner exception stack trace ---
at LNUK.Framework.Common.DBWrapper..ctor()
at SimpleRun.main() in
C:\Raghu\Codebase\DatabaseWrapper\DBWrapperTests\SimpleRun.vb:line 12

This is my app.config file

<configuration>
<configSections>
<section name="applicationConfigurationManagement"
type="Microsoft.ApplicationBlocks.ConfigurationManagement.ConfigurationManagerSectionHandler,Microsoft.ApplicationBlocks.ConfigurationManagement,
Version=1.0.0.0,Culture=neutral,PublicKeyToken=null" />
<section name="DBConfigSection"
type="System.Configuration.DictionarySectionHandler,System,Version=1.0.5000.0,
Culture=neutral,PublicKeyToken=b77a5c561934e089" />
</configSections>
<appSettings>
<add key="log4net.Config"
value="C:\Raghu\Codebase\DatabaseWrapper\log4net.config"></add>

</appSettings>

<applicationConfigurationManagement defaultSection="DBConfigSection">
<configSection name="DBConfigSection">
<configProvider assembly="Microsoft.ApplicationBlocks.ConfigurationManagement,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null"
type="Microsoft.ApplicationBlocks.ConfigurationManagement.Storage.XmlFileStorage"
path="..\..\Config\Database.config"
signed="false"
encrypted="false" />
</configSection>
</applicationConfigurationManagement>
</configuration>



This is my Database.config file referred above

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<DBConfigSection>
<add key="ConnectString" value="Persist Security
Info=False;Integrated
Security=SSPI;database=TestDB;server=LNGWOKD011876;Connect
Timeout=30"></add>
<add key="RetryCount" value="3"></add>
<add key="CommandTimeout" value="30"></add>
</DBConfigSection>
</configuration>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top