Пример #1
0
        /// <summary>
        /// Visits a <see cref="FirstPredicateOperator" /> node.
        /// </summary>
        /// <param name="op">Node to visit.</param>
        /// <returns>Result of visiting the node.</returns>
        protected internal override QueryOperator VisitFirstPredicate(FirstPredicateOperator op)
        {
            var src  = VisitAndConvert <MonadMember>(op.Source);
            var pred = Visit(op.Predicate);

            if (src != op.Source || pred != op.Predicate)
            {
                return(MakeFirstPredicate(op, src, pred));
            }

            return(op);
        }
Пример #2
0
 /// <summary>
 /// Makes a <see cref="FirstPredicateOperator" /> with the given children.
 /// </summary>
 /// <param name="node">Original query expression.</param>
 /// <param name="source">Source query expression.</param>
 /// <param name="predicate">Predicate query expression.</param>
 /// <returns>Representation of the original query expression.</returns>
 protected sealed override QueryOperator MakeFirstPredicate(FirstPredicateOperator node, MonadMember source, QueryTree predicate)
 {
     return(node.QueryExpressionFactory.First(node.ElementType, source, predicate));
 }
Пример #3
0
 /// <summary>
 /// Creates a textual representation of the FirstPredicateOperator with the given children.
 /// </summary>
 /// <param name="node">Original query expression.</param>
 /// <param name="source">Source query expression.</param>
 /// <param name="predicate">Predicate query expression.</param>
 /// <returns>Representation of the original query expression.</returns>
 protected override string MakeFirstPredicate(FirstPredicateOperator node, string source, string predicate)
 {
     return(string.Format(CultureInfo.InvariantCulture, "@First({0}, {1})", source, predicate));
 }
Пример #4
0
 /// <summary>
 /// Makes a <see cref="FirstPredicateOperator" /> with the given children.
 /// </summary>
 /// <param name="node">Original query expression.</param>
 /// <param name="source">Source query expression.</param>
 /// <param name="elementType">Element type for the resulting operator.</param>
 /// <param name="predicate">Predicate query expression.</param>
 /// <returns>Representation of the original query expression.</returns>
 protected virtual QueryOperator MakeFirstPredicate(FirstPredicateOperator node, Type elementType, MonadMember source, QueryTree predicate)
 {
     return(node.QueryExpressionFactory.First(elementType, source, predicate));
 }