SqlNodeAnnotations.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 / Orcas / QFE / ndp / fx / src / DLinq / Dlinq / SqlClient / Common / SqlNodeAnnotations.cs / 1 / SqlNodeAnnotations.cs

                            using System; 
using System.Collections.Generic;
using System.Text;

namespace System.Data.Linq.SqlClient { 

    ///  
    /// Associate annotations with SqlNodes. 
    /// 
    internal class SqlNodeAnnotations { 
        Dictionary> annotationMap = new Dictionary>();
        Dictionary uniqueTypes = new Dictionary();

        ///  
        /// Add an annotation to the given node.
        ///  
        internal void Add(SqlNode node, SqlNodeAnnotation annotation) { 
            List list = null;
 
            if (!this.annotationMap.TryGetValue(node, out list)) {
                list = new List();
                this.annotationMap[node]=list;
            } 

            uniqueTypes[annotation.GetType()] = String.Empty; 
 
            list.Add(annotation);
        } 

        /// 
        /// Gets the annotations for the given node. Null if none.
        ///  
        internal List Get(SqlNode node) {
            List list = null; 
            this.annotationMap.TryGetValue(node, out list); 
            return list;
        } 

        /// 
        /// Whether the given node has annotations.
        ///  
        internal bool NodeIsAnnotated(SqlNode node) {
            if (node == null) 
                return false; 
            return this.annotationMap.ContainsKey(node);
        } 

        /// 
        /// Checks whether there's at least one annotation of the given type.
        ///  
        internal bool HasAnnotationType(Type type) {
            return this.uniqueTypes.ContainsKey(type); 
        } 
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
using System; 
using System.Collections.Generic;
using System.Text;

namespace System.Data.Linq.SqlClient { 

    ///  
    /// Associate annotations with SqlNodes. 
    /// 
    internal class SqlNodeAnnotations { 
        Dictionary> annotationMap = new Dictionary>();
        Dictionary uniqueTypes = new Dictionary();

        ///  
        /// Add an annotation to the given node.
        ///  
        internal void Add(SqlNode node, SqlNodeAnnotation annotation) { 
            List list = null;
 
            if (!this.annotationMap.TryGetValue(node, out list)) {
                list = new List();
                this.annotationMap[node]=list;
            } 

            uniqueTypes[annotation.GetType()] = String.Empty; 
 
            list.Add(annotation);
        } 

        /// 
        /// Gets the annotations for the given node. Null if none.
        ///  
        internal List Get(SqlNode node) {
            List list = null; 
            this.annotationMap.TryGetValue(node, out list); 
            return list;
        } 

        /// 
        /// Whether the given node has annotations.
        ///  
        internal bool NodeIsAnnotated(SqlNode node) {
            if (node == null) 
                return false; 
            return this.annotationMap.ContainsKey(node);
        } 

        /// 
        /// Checks whether there's at least one annotation of the given type.
        ///  
        internal bool HasAnnotationType(Type type) {
            return this.uniqueTypes.ContainsKey(type); 
        } 
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

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