/// <summary>Create a new expression that returns a single result from a source sequence</summary> public FdbQuerySingleExpression(FdbQuerySequenceExpression <T> sequence, string name, Expression <Func <IAsyncEnumerable <T>, CancellationToken, Task <R> > > lambda) { Contract.Requires(sequence != null && lambda != null); this.Sequence = sequence; this.Name = name; this.Handler = lambda; }
public static string ExplainSequence <T>([NotNull] FdbQuerySequenceExpression <T> expression) { if (expression == null) { throw new ArgumentNullException("expression"); } if (expression.Shape != FdbQueryShape.Sequence) { throw new InvalidOperationException("Invalid shape (sequence expected)"); } var expr = expression.CompileSequence(); return(expr.GetDebugView()); }
public static FdbQuerySingleExpression <T, R> Single <T, R>([NotNull] FdbQuerySequenceExpression <T> source, string name, [NotNull] Expression <Func <IFdbAsyncEnumerable <T>, CancellationToken, Task <R> > > lambda) { if (source == null) { throw new ArgumentNullException("source"); } if (lambda == null) { throw new ArgumentNullException("lambda"); } if (name == null) { name = lambda.Name ?? "Lambda"; } return(new FdbQuerySingleExpression <T, R>(source, name, lambda)); }
public static FdbQueryFilterExpression <T> Filter <T>([NotNull] FdbQuerySequenceExpression <T> source, [NotNull] Expression <Func <T, bool> > filter) { if (source == null) { throw new ArgumentNullException("source"); } if (filter == null) { throw new ArgumentNullException("filter"); } if (source.ElementType != typeof(T)) { throw new ArgumentException(String.Format("Source sequence has type {0} that is not compatible with filter input type {1}", source.ElementType.Name, typeof(T).Name), "source"); } return(new FdbQueryFilterExpression <T>(source, filter)); }
public static FdbQueryTransformExpression <T, R> Transform <T, R>([NotNull] FdbQuerySequenceExpression <T> source, [NotNull] Expression <Func <T, R> > transform) { if (source == null) { throw new ArgumentNullException("source"); } if (transform == null) { throw new ArgumentNullException("transform"); } if (source.ElementType != typeof(T)) { throw new ArgumentException(String.Format("Source sequence has type {0} that is not compatible with transform input type {1}", source.ElementType.Name, typeof(T).Name), "source"); } return(new FdbQueryTransformExpression <T, R>(source, transform)); }
/// <summary>Filter out the elements of e sequence that do not match a predicate</summary> public static FdbQueryFilterExpression <T> Filter <T>(FdbQuerySequenceExpression <T> source, Expression <Func <T, bool> > filter) { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (filter == null) { throw new ArgumentNullException(nameof(filter)); } if (source.ElementType != typeof(T)) { throw new ArgumentException($"Source sequence has type {source.ElementType.Name} that is not compatible with filter input type {typeof(T).Name}", nameof(source)); } return(new FdbQueryFilterExpression <T>(source, filter)); }
/// <summary>Transform each elements of a sequence into a new sequence</summary> public static FdbQueryTransformExpression <T, R> Transform <T, R>(FdbQuerySequenceExpression <T> source, Expression <Func <T, R> > transform) { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (transform == null) { throw new ArgumentNullException(nameof(transform)); } if (source.ElementType != typeof(T)) { throw new ArgumentException($"Source sequence has type {source.ElementType.Name} that is not compatible with transform input type {typeof(T).Name}", nameof(source)); } return(new FdbQueryTransformExpression <T, R>(source, transform)); }
internal FdbQueryFilterExpression(FdbQuerySequenceExpression <T> source, Expression <Func <T, bool> > filter) { Contract.Requires(source != null && filter != null); this.Source = source; this.Filter = filter; }
internal FdbQueryTransformExpression(FdbQuerySequenceExpression <T> source, Expression <Func <T, R> > transform) { Contract.Requires(source != null && transform != null); this.Source = source; this.Transform = transform; }