SqlGatherConsumedAliases.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DLinq / Dlinq / SqlClient / Query / SqlGatherConsumedAliases.cs / 1305376 / SqlGatherConsumedAliases.cs

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

namespace System.Data.Linq.SqlClient { 
    /// 
    /// Walk a tree and return the set of unique aliases it consumes. 
    ///  
    class SqlGatherConsumedAliases {
        internal static HashSet Gather(SqlNode node) { 
            Gatherer g = new Gatherer();
            g.Visit(node);
            return g.Consumed;
        } 

        private class Gatherer : SqlVisitor { 
            internal HashSet Consumed = new HashSet(); 

            internal void VisitAliasConsumed(SqlAlias a) { 
                Consumed.Add(a);
            }
            internal override SqlExpression VisitColumn(SqlColumn col) {
                VisitAliasConsumed(col.Alias); 
                VisitExpression(col.Expression);
                return col; 
            } 
            internal override SqlExpression VisitColumnRef(SqlColumnRef cref) {
                VisitAliasConsumed(cref.Column.Alias); 
                return cref;
            }
        }
    } 
}

// 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 { 
    /// 
    /// Walk a tree and return the set of unique aliases it consumes. 
    ///  
    class SqlGatherConsumedAliases {
        internal static HashSet Gather(SqlNode node) { 
            Gatherer g = new Gatherer();
            g.Visit(node);
            return g.Consumed;
        } 

        private class Gatherer : SqlVisitor { 
            internal HashSet Consumed = new HashSet(); 

            internal void VisitAliasConsumed(SqlAlias a) { 
                Consumed.Add(a);
            }
            internal override SqlExpression VisitColumn(SqlColumn col) {
                VisitAliasConsumed(col.Alias); 
                VisitExpression(col.Expression);
                return col; 
            } 
            internal override SqlExpression VisitColumnRef(SqlColumnRef cref) {
                VisitAliasConsumed(cref.Column.Alias); 
                return cref;
            }
        }
    } 
}

// 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