locked
Using the ConfigurationManager class in a class library RRS feed

  • Question

  • User-253259085 posted

    I'd like to use the new CongurationManager class in System.Configuration in a class library, but it is not recognized. It only seemes to be recognized in a website app. I am referencing the System.Configuration.dll on both, but in the class file the only options are:

     ConfigurationException

    ConfigurationSettings

    Any help would be greatly appreciated, thanks.

    Monday, October 23, 2006 6:50 PM

Answers

  • User300685930 posted
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.ComponentModel;
    using System.Web.Security;
    using System.Web.Configuration;

    using System.Data.SqlClient;
    using System.Data;
    using System.Data.SqlTypes;
    using System.Web;

    namespace CodeCampSV
    {
        [DataObject(true)]  // This attribute allows the ObjectDataSource wizard to see this class
        public class AttendeesODS
        {
            string connectionString;
            public AttendeesODS()
            {
                connectionString = WebConfigurationManager.ConnectionStrings["CodeCampSV06"].ConnectionString;
            }
            public class DataObjectAttendees
            {
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 23, 2006 8:20 PM