OdbcReferenceCollection.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Data / System / Data / Odbc / OdbcReferenceCollection.cs / 1 / OdbcReferenceCollection.cs

                            //------------------------------------------------------------------------------ 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
// [....]
//----------------------------------------------------------------------------- 
 
using System;
using System.Data; 
using System.Data.Common;
using System.Data.ProviderBase;
using System.Diagnostics;
 
namespace System.Data.Odbc {
    sealed internal class OdbcReferenceCollection : DbReferenceCollection { 
        internal const int Closing = 0; 
        internal const int Recover = 1;
 
        internal const int CommandTag = 1;

        override public void Add(object value, int tag) {
            base.AddItem(value, tag); 
        }
 
        override protected bool NotifyItem(int message, int tag, object value) { 
            switch (message) {
            case Recover: 
                if (CommandTag == tag) {
                    ((OdbcCommand) value).RecoverFromConnection();
                }
                else { 
                    Debug.Assert(false, "shouldn't be here");
                } 
                break; 
            case Closing:
                if (CommandTag == tag) { 
                    ((OdbcCommand) value).CloseFromConnection();
                }
                else {
                    Debug.Assert(false, "shouldn't be here"); 
                }
                break; 
            default: 
                Debug.Assert(false, "shouldn't be here");
                break; 
            }
            return false;   // remove it from the collection
        }
 
        override public void Remove(object value) {
            base.RemoveItem(value); 
        } 

    } 
}


// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
// [....]
//----------------------------------------------------------------------------- 
 
using System;
using System.Data; 
using System.Data.Common;
using System.Data.ProviderBase;
using System.Diagnostics;
 
namespace System.Data.Odbc {
    sealed internal class OdbcReferenceCollection : DbReferenceCollection { 
        internal const int Closing = 0; 
        internal const int Recover = 1;
 
        internal const int CommandTag = 1;

        override public void Add(object value, int tag) {
            base.AddItem(value, tag); 
        }
 
        override protected bool NotifyItem(int message, int tag, object value) { 
            switch (message) {
            case Recover: 
                if (CommandTag == tag) {
                    ((OdbcCommand) value).RecoverFromConnection();
                }
                else { 
                    Debug.Assert(false, "shouldn't be here");
                } 
                break; 
            case Closing:
                if (CommandTag == tag) { 
                    ((OdbcCommand) value).CloseFromConnection();
                }
                else {
                    Debug.Assert(false, "shouldn't be here"); 
                }
                break; 
            default: 
                Debug.Assert(false, "shouldn't be here");
                break; 
            }
            return false;   // remove it from the collection
        }
 
        override public void Remove(object value) {
            base.RemoveItem(value); 
        } 

    } 
}


// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK