示例#1
0
        /// <summary>
        /// Create a parameter expression
        /// </summary>
        public override Expression ToExpression()
        {
            if (this.m_expression != null)
            {
                return(this.m_expression);
            }

            if (this.Type == null)
            {
                throw new InvalidOperationException("Type not set");
            }

            // Is there some parameter in the parent context?
            XmlExpression xe = this.Parent;

            while (xe != null && this.m_expression == null)
            {
                this.m_expression = (xe as XmlLambdaExpression)?.Parameters.Find(o => o.ParameterName == this.ParameterName)?.ToExpression() as ParameterExpression;
                xe = xe.Parent;
            }

            if (this.m_expression == null)
            {
                this.m_expression = Expression.Parameter(this.Type, this.ParameterName);
            }
            return(this.m_expression);
        }
示例#2
0
 /// <summary>
 /// Initialize context
 /// </summary>
 public virtual void InitializeContext(XmlExpression context)
 {
     foreach (var itm in this.Item)
     {
         itm.InitializeContext(context);
     }
 }
示例#3
0
 /// <summary>
 /// Initialize context
 /// </summary>
 public override void InitializeContext(XmlExpression context)
 {
     base.InitializeContext(context);
     foreach (var itm in this.Parts)
     {
         itm.InitializeContext(this);
     }
 }
示例#4
0
        /// <summary>
        /// Creates an XmlBinaryExpression from the specified binary expression
        /// </summary>
        public XmlBinaryExpression(BinaryExpression expr)
        {
            BinaryOperatorType opType = BinaryOperatorType.AndAlso;

            if (!Enum.TryParse <BinaryOperatorType>(expr.NodeType.ToString(), out opType))
            {
                throw new ArgumentOutOfRangeException(nameof(Expression.NodeType));
            }
            this.Operator = opType;

            this.Parts = new List <XmlExpression>()
            {
                XmlExpression.FromExpression(expr.Left),
                XmlExpression.FromExpression(expr.Right)
            };
        }
 /// <summary>
 /// Initialize context
 /// </summary>
 public override void InitializeContext(XmlExpression context)
 {
     base.InitializeContext(context);
     this.Parameters.InitializeContext(this);
 }
示例#6
0
 /// <summary>
 /// Initialize context
 /// </summary>
 public override void InitializeContext(XmlExpression context)
 {
     base.InitializeContext(context);
     //foreach (var itm in this.Parameters)
     //    itm.InitializeContext(this);
 }
示例#7
0
 /// <summary>
 /// Creates a new xml expression list
 /// </summary>
 public XmlExpressionList(IEnumerable <Expression> expr)
 {
     this.Item = new List <XmlExpression>(expr.Select(o => XmlExpression.FromExpression(o)));
 }
示例#8
0
 /// <summary>
 /// Creates the bound expression
 /// </summary>
 public XmlBoundExpression(MethodCallExpression expr)
 {
     this.Object = XmlExpression.FromExpression(expr.Object);
 }
示例#9
0
 /// <summary>
 /// Creates the bound expression
 /// </summary>
 public XmlBoundExpression(UnaryExpression expr)
 {
     this.Object = XmlExpression.FromExpression(expr.Operand);
 }
示例#10
0
 /// <summary>
 /// Creates the bound expression
 /// </summary>
 public XmlBoundExpression(MemberExpression expr)
 {
     this.Object = XmlExpression.FromExpression(expr.Expression);
 }
示例#11
0
 /// <summary>
 /// Creates type bound expression
 /// </summary>
 /// <param name="expr"></param>
 public XmlBoundExpression(TypeBinaryExpression expr)
 {
     this.Object = XmlExpression.FromExpression(expr.Expression);
 }
示例#12
0
 /// <summary>
 /// Creates the bound expression
 /// </summary>
 public XmlBoundExpression(Expression expr)
 {
     this.Object = XmlExpression.FromExpression(expr);
 }
示例#13
0
 /// <summary>
 /// Initialize context
 /// </summary>
 public override void InitializeContext(XmlExpression context)
 {
     base.InitializeContext(context);
     this.Object?.InitializeContext(this);
 }
示例#14
0
 /// <summary>
 /// Initialize the context
 /// </summary>
 public virtual void InitializeContext(XmlExpression context)
 {
     this.Parent = context;
 }