/// <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);
        }
Beispiel #2
0
 /// <summary>
 /// Initialize context
 /// </summary>
 public virtual void InitializeContext(XmlExpression context)
 {
     foreach (var itm in this.Item)
     {
         itm.InitializeContext(context);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Initialize context
 /// </summary>
 public override void InitializeContext(XmlExpression context)
 {
     base.InitializeContext(context);
     foreach (var itm in this.Parts)
     {
         itm.InitializeContext(this);
     }
 }
Beispiel #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);
 }
Beispiel #6
0
 /// <summary>
 /// Initialize context
 /// </summary>
 public override void InitializeContext(XmlExpression context)
 {
     base.InitializeContext(context);
     //foreach (var itm in this.Parameters)
     //    itm.InitializeContext(this);
 }
Beispiel #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)));
 }
Beispiel #8
0
 /// <summary>
 /// Creates the bound expression
 /// </summary>
 public XmlBoundExpression(MethodCallExpression expr)
 {
     this.Object = XmlExpression.FromExpression(expr.Object);
 }
Beispiel #9
0
 /// <summary>
 /// Creates the bound expression
 /// </summary>
 public XmlBoundExpression(UnaryExpression expr)
 {
     this.Object = XmlExpression.FromExpression(expr.Operand);
 }
Beispiel #10
0
 /// <summary>
 /// Creates the bound expression
 /// </summary>
 public XmlBoundExpression(MemberExpression expr)
 {
     this.Object = XmlExpression.FromExpression(expr.Expression);
 }
Beispiel #11
0
 /// <summary>
 /// Creates type bound expression
 /// </summary>
 /// <param name="expr"></param>
 public XmlBoundExpression(TypeBinaryExpression expr)
 {
     this.Object = XmlExpression.FromExpression(expr.Expression);
 }
Beispiel #12
0
 /// <summary>
 /// Creates the bound expression
 /// </summary>
 public XmlBoundExpression(Expression expr)
 {
     this.Object = XmlExpression.FromExpression(expr);
 }
Beispiel #13
0
 /// <summary>
 /// Initialize context
 /// </summary>
 public override void InitializeContext(XmlExpression context)
 {
     base.InitializeContext(context);
     this.Object?.InitializeContext(this);
 }
Beispiel #14
0
 /// <summary>
 /// Initialize the context
 /// </summary>
 public virtual void InitializeContext(XmlExpression context)
 {
     this.Parent = context;
 }