Index: src/Appender/AdoNetAppender.cs
===================================================================
--- src/Appender/AdoNetAppender.cs (revision 429521)
+++ src/Appender/AdoNetAppender.cs (working copy)
@@ -21,6 +21,9 @@
using System;
using System.Collections;
+#if NET_2_0
+using System.Configuration;
+#endif
using System.Data;
using System.IO;
using System.Reflection;
@@ -172,7 +175,38 @@
set { m_connectionString = value; }
}
+ #if NET_2_0
///
+ /// Gets or set the name of a connection string specified in the ConnectionStrings
+ /// section of an App.config or Web.config file used to connect to the database.
+ ///
+ ///
+ /// The name of a connection string within the ConnectionStrings section.
+ ///
+ ///
+ ///
+ /// The property takes precedence over this setting.
+ ///
+ ///
+ ///
+ /// A ConnectionStrings section might look like this:
+ ///
+ /// <qconfiguration>
+ /// <connectionStrings>
+ /// <add name="someDbConn" connectionString="Server=localhost;Database=SomeDb;Trusted_Connection=True" />
+ /// </connectionStrings>
+ /// </configuration>
+ ///
+ /// Which can be referenced by setting the ConnectionStringName to "someDbConn".
+ ///
+ public string ConnectionStringName
+ {
+ get { return this.m_connectionStringName; }
+ set { this.m_connectionStringName = value; }
+ }
+ #endif
+
+ ///
/// Gets or sets the type name of the connection
/// that should be created.
///
@@ -652,6 +686,15 @@
// Create the connection object
m_dbConnection = (IDbConnection)Activator.CreateInstance(ResolveConnectionType());
+#if NET_2_0
+ if(String.IsNullOrEmpty(m_connectionString) && !String.IsNullOrEmpty(m_connectionStringName))
+ {
+ if (ConfigurationManager.ConnectionStrings[m_connectionStringName] != null)
+ {
+ m_connectionString = ConfigurationManager.ConnectionStrings[m_connectionStringName].ConnectionString;
+ }
+ }
+#endif
// Set the connection string
m_dbConnection.ConnectionString = m_connectionString;
@@ -853,7 +896,14 @@
///
private string m_connectionString;
+ #if NET_2_0
///
+ /// Name of the Connection string setting within the ConnectionStrings area.
+ ///
+ private string m_connectionStringName;
+ #endif
+
+ ///
/// String type name of the type name.
///
private string m_connectionType;