Exemplo n.º 1
0
        /// <summary>
        /// Purpose: Initializes class members.
        /// </summary>
        private void InitClass()
        {
            // create all the objects and initialize other members.
            m_scoMainConnection             = new SqlConnection();
            m_bMainConnectionIsCreatedLocal = true;
            m_cpMainConnectionProvider      = null;
            AppSettingsReader m_asrConfigReader = new AppSettingsReader();

            // Set connection string of the sqlconnection object
            m_scoMainConnection.ConnectionString =
                m_asrConfigReader.GetValue("Main.ConnectionString", typeof(string)).ToString();
            m_bIsDisposed = false;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Purpose: Implements the Dispose functionality.
 /// </summary>
 protected virtual void Dispose(bool bIsDisposing)
 {
     // Check to see if Dispose has already been called.
     if (!m_bIsDisposed)
     {
         if (bIsDisposing)
         {
             // Dispose managed resources.
             if (m_bMainConnectionIsCreatedLocal)
             {
                 // Object is created in this class, so destroy it here.
                 m_scoMainConnection.Close();
                 m_scoMainConnection.Dispose();
                 m_bMainConnectionIsCreatedLocal = false;
             }
             m_cpMainConnectionProvider = null;
             m_scoMainConnection        = null;
         }
     }
     m_bIsDisposed = true;
 }