deserialize to C# class from external config file?



I'm using System.Configuration in .NET 2.0 to load in values
from an externally specified config file and deserialize
them into a C# class. During deserialization, I'm getting
an exception thrown by .NET It's having a problem with
the <connections> element seen below. I've tried different things, but
still I can't get the deserialize to succeed. Here's the problem in
detail below.

Can anybody tell me what I'm doing wrong? Shouldn't
[xmlArray] work?

Thx,
Tom

The app.config file looks like this:

<configuation>
<configSections>
<section name="dataAccessSection"
type="Framework.Data.DataAccessConfig,Framework.Data,Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null"/>
</configSections>

<dataAccessSection configSource="DataAccess.config"/>
</configuation>

DataAccess.config looks like this:

<dataAccessSection>
<connections>
<connection name="fsa">
<connectionEnvs>
<connectionEnv envName="INT1" assembly="System.Data,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
type="System.Data.OleDb.OleDbConnection"
connectionString="Provider=OraOLEDB.Oracle;Password={0};Persist Security
Info=True;User ID=fiisbsvc;Data Source=dbenv022"
connectionStringPassword="lttC8Hg29Nfks+3QPI8Hxg==">
</connectionEnv>
</connectionEnvs>
</connection>
</connections>
<commands/>
<maps/>
</dataAccessSection>


The C# class looks like this:

using System;
using System.Xml.Serialization;
using System.Configuration;

namespace Framework.Data
{
/// <summary>
/// Represents the root of all data access configuration information.
/// </summary>
public class DataAccessConfig : ConfigurationSection
{
#region Constructor(s)

/// <summary>
/// Initializes a new instance of the <see cref="DataAccessConfig"/>
class.
/// </summary>
public DataAccessConfig()
{
_sectionName = _defaultSectionName;
}

#endregion

#region Config Manager
private const string _defaultSectionName = "dataAccessSection";
private string _sectionName;

#region Connection Config

private ConnectionConfigCollection _connections = new
ConnectionConfigCollection();

/// <summary>
/// Gets or sets the collection of connection configuration items
associated with this application.
/// </summary>
/// <value>The collection of connection configuration items associated
with this application.</value>
[XmlArray("connections")]
[XmlArrayItem("connection")]
// [ConfigurationProperty("connections")]
// [ConfigurationCollection(typeof(ConnectionConfigCollection))]
public ConnectionConfigCollection Connections
{
get
{
return _connections;
}
set
{
_connections = value;
}
}
..
..
..
}

.



Relevant Pages

  • Re: Need Help on setting up a small home site.
    ... > told me that I have to open that port and forward request to my ... computer is the first network device. ... connections to port 80, so that they can be routed through to something ... > So if U don't consider it rude to post a long config file here, ...
    (comp.infosystems.www.servers.unix)
  • re: rblsmtpd/qmail-smtpd hung processes
    ... After a while the server just quits accepting smtp connections, or will connect/disconnect very quickly. ... I only had about 3 weeks notice on this and I've been configuring a pair of FreeBSD machines to take over DNS and E-Mail for about a dozen sites. ... Basically I've been on a crash course of learning as I go. ... The file "toaster.conf" file needs to be 644 so that when rotating logs, the programs can re-read the config. ...
    (freebsd-questions)
  • Re: port forwarding and ipfw rules
    ... redirect any connections to .19.110:443 to .19.109:443 ... redirect_port tcp .19.109:443 .19.110:443 ... Also my g/w is currently 5.2.1 but the config should be same ... fxp0: flags=8943mtu 1500 ...
    (freebsd-net)
  • RE: [fw-wiz] Cisco VPN Client "Stateful Firewall (Always On)"
    ... under network config in Windows 2000/NT. ... I have insisted that a firewall be included in this ... Basically, as I understand it, this feature allows all outbound ... connections while active, and all inbound connections originally established ...
    (Firewall-Wizards)
  • Cannot connect to Terminal service remote admin
    ... I used to be able to connect to my SBS machine from my XP Pro workstation. ... I stepped through the config and everthing is the same. ... Remote connections are enabled. ... I am admin on the server and member of Remopte Ops. ...
    (microsoft.public.windows.server.sbs)

Loading