Ejemplo n.º 1
0
            private QueryOperator UpdateSelect(SelectOperator op, MonadMember src, QueryTree selector)
            {
                if (src != op.Source || selector != op.Selector)
                {
                    return(MakeSelect(op, src, selector));
                }

                return(op);
            }
 /// <summary>
 /// Creates a <see cref="WhereOperator" /> that represents a where operator.
 /// </summary>
 /// <param name="elementType">The <see cref="Type" /> of the elements in the resulting monad.</param>
 /// <param name="source">The monad whose elements to filter.</param>
 /// <param name="predicate">The function to test each source element for a condition.</param>
 /// <returns>A <see cref="WhereOperator" /> that has the given source.</returns>
 public abstract WhereOperator Where(Type elementType, MonadMember source, QueryTree predicate);
 /// <summary>
 /// Creates a <see cref="SelectOperator" /> that represents a select operator.
 /// </summary>
 /// <param name="elementType">The <see cref="Type" /> of the elements in the resulting monad.</param>
 /// <param name="inputElementType">The <see cref="Type" /> of the elements in the source monad.</param>
 /// <param name="source">The monad to invoke a transform function on.</param>
 /// <param name="selector">A transform function to apply to each source element.</param>
 /// <returns>A <see cref="SelectOperator" /> that has the given source.</returns>
 public abstract SelectOperator Select(Type elementType, Type inputElementType, MonadMember source, QueryTree selector);
 /// <summary>
 /// Creates a <see cref="FirstOperator" /> that represents a take operator.
 /// </summary>
 /// <param name="elementType">The <see cref="Type" /> of the elements in the resulting monad.</param>
 /// <param name="source">The monad to take elements from.</param>
 /// <param name="count">The number of elements to return.</param>
 /// <returns>A <see cref="FirstOperator" /> that has the given source.</returns>
 public abstract TakeOperator Take(Type elementType, MonadMember source, QueryTree count);
 /// <summary>
 /// Creates a <see cref="FirstOperator" /> that represents a first operator.
 /// </summary>
 /// <param name="elementType">The <see cref="Type" /> of the elements in the resulting monad.</param>
 /// <param name="source">The monad from which to get the first element.</param>
 /// <returns>A <see cref="FirstOperator" /> that has the given source.</returns>
 public abstract FirstOperator First(Type elementType, MonadMember source);
 /// <summary>
 /// Creates a <see cref="FirstPredicateOperator" /> that represents a first operator with a predicate.
 /// </summary>
 /// <param name="elementType">The <see cref="Type" /> of the elements in the resulting monad.</param>
 /// <param name="source">The monad from which to get the first element satisfying a condition.</param>
 /// <param name="predicate">The function to test each source element for a condition.</param>
 /// <returns>A <see cref="FirstPredicateOperator" /> that has the given source.</returns>
 public abstract FirstPredicateOperator First(Type elementType, MonadMember source, QueryTree predicate);
 /// <summary>
 /// Creates a <see cref="SelectOperator" /> that represents a select operator.
 /// </summary>
 /// <param name="elementType">The <see cref="Type" /> of the elements in the resulting monad.</param>
 /// <param name="inputElementType">The <see cref="Type" /> of the elements in the source monad.</param>
 /// <param name="source">The monad to invoke a transform function on.</param>
 /// <param name="selector">A transform function to apply to each source element.</param>
 /// <returns>A <see cref="SelectOperator" /> that has the given source.</returns>
 public SelectOperator Select(Type elementType, Type inputElementType, MonadMember source, QueryTree selector)
 {
     return(new SelectOperator(elementType, inputElementType, source, selector));
 }
 /// <summary>
 /// Creates a <see cref="FirstOperator" /> that represents a take operator.
 /// </summary>
 /// <param name="elementType">The <see cref="Type" /> of the elements in the resulting monad.</param>
 /// <param name="source">The monad to take elements from.</param>
 /// <param name="count">The number of elements to return.</param>
 /// <returns>A <see cref="FirstOperator" /> that has the given source.</returns>
 public TakeOperator Take(Type elementType, MonadMember source, QueryTree count)
 {
     return(new TakeOperator(elementType, source, count));
 }
 /// <summary>
 /// Creates a <see cref="FirstOperator" /> that represents a first operator.
 /// </summary>
 /// <param name="elementType">The <see cref="Type" /> of the elements in the resulting monad.</param>
 /// <param name="source">The monad from which to get the first element.</param>
 /// <returns>A <see cref="FirstOperator" /> that has the given source.</returns>
 public FirstOperator First(Type elementType, MonadMember source)
 {
     return(new FirstOperator(elementType, source));
 }
 /// <summary>
 /// Creates a <see cref="FirstPredicateOperator" /> that represents a first operator with a predicate.
 /// </summary>
 /// <param name="elementType">The <see cref="Type" /> of the elements in the resulting monad.</param>
 /// <param name="source">The monad from which to get the first element satisfying a condition.</param>
 /// <param name="predicate">The function to test each source element for a condition.</param>
 /// <returns>A <see cref="FirstPredicateOperator" /> that has the given source.</returns>
 public FirstPredicateOperator First(Type elementType, MonadMember source, QueryTree predicate)
 {
     return(new FirstPredicateOperator(elementType, source, predicate));
 }
 /// <summary>
 /// Creates a <see cref="WhereOperator" /> that represents a where operator.
 /// </summary>
 /// <param name="elementType">The <see cref="Type" /> of the elements in the resulting monad.</param>
 /// <param name="source">The monad whose elements to filter.</param>
 /// <param name="predicate">The function to test each source element for a condition.</param>
 /// <returns>A <see cref="WhereOperator" /> that has the given source.</returns>
 public WhereOperator Where(Type elementType, MonadMember source, QueryTree predicate)
 {
     return(new WhereOperator(elementType, source, predicate));
 }
Ejemplo n.º 12
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));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Makes a <see cref="FirstOperator" /> with the given children.
 /// </summary>
 /// <param name="node">Original query expression.</param>
 /// <param name="elementType">Element type for the resulting operator.</param>
 /// <param name="source">Source query expression.</param>
 /// <returns>Representation of the original query expression.</returns>
 protected virtual QueryOperator MakeFirst(FirstOperator node, Type elementType, MonadMember source)
 {
     return(node.QueryExpressionFactory.First(elementType, source));
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Makes a <see cref="TakeOperator" /> 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="count">Count query expression.</param>
 /// <returns>Representation of the original query expression.</returns>
 protected virtual QueryOperator MakeTake(TakeOperator node, Type elementType, MonadMember source, QueryTree count)
 {
     return(node.QueryExpressionFactory.Take(elementType, source, count));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Makes a <see cref="SelectOperator" /> 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="inputElementType">Input element type for the resulting operator.</param>
 /// <param name="selector">Selector query expression.</param>
 /// <returns>Representation of the original query expression.</returns>
 protected virtual QueryOperator MakeSelect(SelectOperator node, Type elementType, Type inputElementType, MonadMember source, QueryTree selector)
 {
     return(node.QueryExpressionFactory.Select(elementType, inputElementType, source, selector));
 }