DataServiceExpressionVisitor.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 / DataWeb / Client / System / Data / Services / Client / ALinq / DataServiceExpressionVisitor.cs / 1 / DataServiceExpressionVisitor.cs

                            //---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//  
//      Expression Visitors for Linq to URI translator
//  
// 
// @owner  [....]
//--------------------------------------------------------------------- 
namespace System.Data.Services.Client
{
    using System;
    using System.Collections.Generic; 
    using System.Collections.ObjectModel;
    using System.Linq; 
    using System.Text; 
    using System.Linq.Expressions;
    using System.Diagnostics; 

    /// 
    /// Specific Vistior base class for the DataServiceQueryProvider.
    ///  
    internal abstract class DataServiceExpressionVisitor : ExpressionVisitor
    { 
        ///  
        /// Main visit method.
        ///  
        /// Expression to visit
        /// Visited expression
        internal override Expression Visit(Expression exp)
        { 
            if (exp == null)
            { 
                return null; 
            }
 
            switch ((ResourceExpressionType)exp.NodeType)
            {
                case ResourceExpressionType.RootResourceSet:
                case ResourceExpressionType.ResourceNavigationProperty: 
                    return this.VisitResourceSetExpression((ResourceSetExpression)exp);
                case ResourceExpressionType.ResourceNavigationPropertySingleton: 
                    return this.VisitNavigationPropertySingletonExpression((NavigationPropertySingletonExpression)exp); 
                case ResourceExpressionType.InputReference:
                    return this.VisitInputReferenceExpression((InputReferenceExpression)exp); 
                default:
                    return base.Visit(exp);
            }
        } 

        ///  
        /// ResourceSetExpression visit method. 
        /// 
        /// ResourceSetExpression expression to visit 
        /// Visited ResourceSetExpression expression
        internal virtual Expression VisitResourceSetExpression(ResourceSetExpression rse)
        {
            Expression source = this.Visit(rse.Source); 

            if (source != rse.Source) 
            { 
                rse = new ResourceSetExpression(rse.Type, source, rse.MemberExpression, rse.ResourceType, rse.ExpandPaths, rse.CustomQueryOptions);
            } 

            return rse;
        }
 
        /// 
        /// NavigationPropertySingletonExpressionvisit method. 
        ///  
        /// NavigationPropertySingletonExpression expression to visit
        /// Visited NavigationPropertySingletonExpression expression 
        internal virtual Expression VisitNavigationPropertySingletonExpression(NavigationPropertySingletonExpression npse)
        {
            Expression source = this.Visit(npse.Source);
 
            if (source != npse.Source)
            { 
                npse = new NavigationPropertySingletonExpression(npse.Type, source, npse.MemberExpression, npse.ExpandPaths, npse.CustomQueryOptions); 
            }
 
            return npse;
        }

        ///  
        /// Visit an , producing a new InputReferenceExpression
        /// based on the visited form of the  that is referenced by 
        /// the InputReferenceExpression argument, . 
        /// 
        /// InputReferenceExpression expression to visit 
        /// Visited InputReferenceExpression expression
        internal virtual Expression VisitInputReferenceExpression(InputReferenceExpression ire)
        {
            if (ire == null) 
            {
                return null; 
            } 

            ResourceExpression re = (ResourceExpression)this.Visit(ire.Target); 
            return re.CreateReference();
        }
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//  
//      Expression Visitors for Linq to URI translator
//  
// 
// @owner  [....]
//--------------------------------------------------------------------- 
namespace System.Data.Services.Client
{
    using System;
    using System.Collections.Generic; 
    using System.Collections.ObjectModel;
    using System.Linq; 
    using System.Text; 
    using System.Linq.Expressions;
    using System.Diagnostics; 

    /// 
    /// Specific Vistior base class for the DataServiceQueryProvider.
    ///  
    internal abstract class DataServiceExpressionVisitor : ExpressionVisitor
    { 
        ///  
        /// Main visit method.
        ///  
        /// Expression to visit
        /// Visited expression
        internal override Expression Visit(Expression exp)
        { 
            if (exp == null)
            { 
                return null; 
            }
 
            switch ((ResourceExpressionType)exp.NodeType)
            {
                case ResourceExpressionType.RootResourceSet:
                case ResourceExpressionType.ResourceNavigationProperty: 
                    return this.VisitResourceSetExpression((ResourceSetExpression)exp);
                case ResourceExpressionType.ResourceNavigationPropertySingleton: 
                    return this.VisitNavigationPropertySingletonExpression((NavigationPropertySingletonExpression)exp); 
                case ResourceExpressionType.InputReference:
                    return this.VisitInputReferenceExpression((InputReferenceExpression)exp); 
                default:
                    return base.Visit(exp);
            }
        } 

        ///  
        /// ResourceSetExpression visit method. 
        /// 
        /// ResourceSetExpression expression to visit 
        /// Visited ResourceSetExpression expression
        internal virtual Expression VisitResourceSetExpression(ResourceSetExpression rse)
        {
            Expression source = this.Visit(rse.Source); 

            if (source != rse.Source) 
            { 
                rse = new ResourceSetExpression(rse.Type, source, rse.MemberExpression, rse.ResourceType, rse.ExpandPaths, rse.CustomQueryOptions);
            } 

            return rse;
        }
 
        /// 
        /// NavigationPropertySingletonExpressionvisit method. 
        ///  
        /// NavigationPropertySingletonExpression expression to visit
        /// Visited NavigationPropertySingletonExpression expression 
        internal virtual Expression VisitNavigationPropertySingletonExpression(NavigationPropertySingletonExpression npse)
        {
            Expression source = this.Visit(npse.Source);
 
            if (source != npse.Source)
            { 
                npse = new NavigationPropertySingletonExpression(npse.Type, source, npse.MemberExpression, npse.ExpandPaths, npse.CustomQueryOptions); 
            }
 
            return npse;
        }

        ///  
        /// Visit an , producing a new InputReferenceExpression
        /// based on the visited form of the  that is referenced by 
        /// the InputReferenceExpression argument, . 
        /// 
        /// InputReferenceExpression expression to visit 
        /// Visited InputReferenceExpression expression
        internal virtual Expression VisitInputReferenceExpression(InputReferenceExpression ire)
        {
            if (ire == null) 
            {
                return null; 
            } 

            ResourceExpression re = (ResourceExpression)this.Visit(ire.Target); 
            return re.CreateReference();
        }
    }
} 

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