Geez...seems like i've compared every friggin character...works n this
programA but not n programB. I have a config file with multiple
sections and when trying to read each section, it works great in one
program and not in another. I basically copied and pasted the config
file as well as the section handlers , changed references from programA
to programB but on every section in programB I get like "Could not
create PRICING.BRASSSectionHandler,PRICING". I've verified my
namespace and assembly names are 'pricing'. Any help would be greatly
appreciated and i mean mucho! Thanks in advance..Michael
Here's the config file and associated code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section
name="BRASSSection"
type="PRICING.BRASSSectionHandler,PRICING" />
<section
name="IDCSection"
type="PRICING.IDCSectionHandler,PRICING" />
</configSections>
<appSettings>
<add key="DebugSwitch" value="N" />
</appSettings>
<BRASSSection appName="BRASS">
<InputFile>c:\Code\BatchCode\ProgramInput\BrassInp utFile.txt</InputFile>
<ProcessedSecuritiesReport>c:\Code\BatchCode\Progr amInput\BrassProcessSecurities.txt</ProcessedSecuritiesReport>
<UnProcessedSecuritiesReport>c:\Code\BatchCode\Pro gramReports\BrassUnProcessSecurities.txt</UnProcessedSecuritiesReport>
<PricingServer>I</PricingServer>
<InventoryPricingServer>204.110.192.57[5176]</InventoryPricingServer>
<ErrorPercentage>10</ErrorPercentage>
</BRASSSection>
<IDCSection appName="IDC">
<InputFile>c:\Code\BatchCode\ProgramInput\IDCInput File.txt</InputFile>
<ProcessedSecuritiesReport>c:\Code\BatchCode\Progr amInput\IDCProcessSecurities.txt</ProcessedSecuritiesReport>
<UnProcessedSecuritiesReport>c:\Code\BatchCode\Pro gramReports\IDCUnProcessSecurities.txt</UnProcessedSecuritiesReport>
<PricingServer>B</PricingServer>
<ErrorPercentage>10</ErrorPercentage>
</IDCSection>
</configuration>
Public Class BRASSSectionHandler
Implements IConfigurationSectionHandler
Public Function Create(ByVal parent As Object, _
ByVal configContext As Object, _
ByVal section As System.Xml.XmlNode) As Object _
Implements
System.Configuration.IConfigurationSectionHandler. Create
Dim data As New NameValueCollection
Dim root As XmlElement = CType(section, XmlElement)
Dim node As XmlNode
For Each node In root.ChildNodes
data.Add(node.Name, node.InnerText)
Next
'Create and return the settings container
Return New BRASSSectionData(root.GetAttribute("appName"), data)
End Function
End Class
Public Class BRASSSectionData
Private mAppName As String
Private mData As New NameValueCollection
Public ReadOnly Property AppName() As String
Get
Return mAppName
End Get
End Property
Default Public ReadOnly Property Setting(ByVal Name As String) As
String
Get
Return mData(Name)
End Get
End Property
Public Sub New(ByVal AppName As String, ByVal Data As
NameValueCollection)
mAppName = AppName
mData = Data
End Sub
End Class