/* Copyright 2015-present MongoDB Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Threading; using System.Threading.Tasks; namespace MongoDB.Driver.Linq { /// /// Extension for . /// public static class MongoQueryable { /// /// Determines whether a sequence contains any elements. /// /// The type of the elements of . /// A sequence to check for being empty. /// The cancellation token. /// /// true if the source sequence contains any elements; otherwise, false. /// public static Task AnyAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, bool>(Queryable.Any, source), source.Expression), cancellationToken); } /// /// Determines whether any element of a sequence satisfies a condition. /// /// The type of the elements of . /// A sequence whose elements to test for a condition. /// A function to test each element for a condition. /// The cancellation token. /// /// true if any elements in the source sequence pass the test in the specified predicate; otherwise, false. /// public static Task AnyAsync(this IMongoQueryable source, Expression> predicate, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, bool>(Queryable.Any, source, predicate), source.Expression, Expression.Quote(predicate)), cancellationToken); } /// /// Computes the average of a sequence of values. /// /// A sequence of values to calculate the average of. /// The cancellation token. /// The average of the values in the sequence. public static Task AverageAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, decimal>(Queryable.Average, source), source.Expression), cancellationToken); } /// /// Computes the average of a sequence of values. /// /// A sequence of values to calculate the average of. /// The cancellation token. /// The average of the values in the sequence. public static Task AverageAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, decimal?>(Queryable.Average, source), source.Expression), cancellationToken); } /// /// Computes the average of a sequence of values. /// /// A sequence of values to calculate the average of. /// The cancellation token. /// The average of the values in the sequence. public static Task AverageAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, double>(Queryable.Average, source), source.Expression), cancellationToken); } /// /// Computes the average of a sequence of values. /// /// A sequence of values to calculate the average of. /// The cancellation token. /// The average of the values in the sequence. public static Task AverageAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, double?>(Queryable.Average, source), source.Expression), cancellationToken); } /// /// Computes the average of a sequence of values. /// /// A sequence of values to calculate the average of. /// The cancellation token. /// The average of the values in the sequence. public static Task AverageAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, float>(Queryable.Average, source), source.Expression), cancellationToken); } /// /// Computes the average of a sequence of values. /// /// A sequence of values to calculate the average of. /// The cancellation token. /// The average of the values in the sequence. public static Task AverageAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, float?>(Queryable.Average, source), source.Expression), cancellationToken); } /// /// Computes the average of a sequence of values. /// /// A sequence of values to calculate the average of. /// The cancellation token. /// The average of the values in the sequence. public static Task AverageAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, double>(Queryable.Average, source), source.Expression), cancellationToken); } /// /// Computes the average of a sequence of values. /// /// A sequence of values to calculate the average of. /// The cancellation token. /// The average of the values in the sequence. public static Task AverageAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, double?>(Queryable.Average, source), source.Expression), cancellationToken); } /// /// Computes the average of a sequence of values. /// /// A sequence of values to calculate the average of. /// The cancellation token. /// The average of the values in the sequence. public static Task AverageAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, double>(Queryable.Average, source), source.Expression), cancellationToken); } /// /// Computes the average of a sequence of values. /// /// A sequence of values to calculate the average of. /// The cancellation token. /// The average of the values in the sequence. public static Task AverageAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, double?>(Queryable.Average, source), source.Expression), cancellationToken); } /// /// Computes the average of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The average of the projected values. /// public static Task AverageAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, decimal>(Queryable.Average, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the average of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The average of the projected values. /// public static Task AverageAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, decimal?>(Queryable.Average, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the average of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The average of the projected values. /// public static Task AverageAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, double>(Queryable.Average, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the average of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The average of the projected values. /// public static Task AverageAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, double?>(Queryable.Average, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the average of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The average of the projected values. /// public static Task AverageAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, float>(Queryable.Average, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the average of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The average of the projected values. /// public static Task AverageAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, float?>(Queryable.Average, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the average of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The average of the projected values. /// public static Task AverageAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, double>(Queryable.Average, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the average of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The average of the projected values. /// public static Task AverageAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, double?>(Queryable.Average, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the average of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The average of the projected values. /// public static Task AverageAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, double>(Queryable.Average, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the average of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The average of the projected values. /// public static Task AverageAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, double?>(Queryable.Average, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Returns the number of elements in a sequence. /// /// The type of the elements of . /// The that contains the elements to be counted. /// The cancellation token. /// /// The number of elements in the input sequence. /// public static Task CountAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, int>(Queryable.Count, source), source.Expression), cancellationToken); } /// /// Returns the number of elements in the specified sequence that satisfies a condition. /// /// The type of the elements of . /// An that contains the elements to be counted. /// A function to test each element for a condition. /// The cancellation token. /// /// The number of elements in the sequence that satisfies the condition in the predicate function. /// public static Task CountAsync(this IMongoQueryable source, Expression> predicate, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, int>(Queryable.Count, source, predicate), source.Expression, Expression.Quote(predicate)), cancellationToken); } /// /// Returns distinct elements from a sequence by using the default equality comparer to compare values. /// /// The type of the elements of . /// The to remove duplicates from. /// /// An that contains distinct elements from . /// public static IMongoQueryable Distinct(this IMongoQueryable source) { return (IMongoQueryable)Queryable.Distinct(source); } /// /// Returns the first element of a sequence. /// /// The type of the elements of . /// The to return the first element of. /// The cancellation token. /// /// The first element in . /// public static Task FirstAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, TSource>(Queryable.First, source), source.Expression), cancellationToken); } /// /// Returns the first element of a sequence that satisfies a specified condition. /// /// The type of the elements of . /// An to return an element from. /// A function to test each element for a condition. /// The cancellation token. /// /// The first element in that passes the test in . /// public static Task FirstAsync(this IMongoQueryable source, Expression> predicate, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, TSource>(Queryable.First, source, predicate), source.Expression, Expression.Quote(predicate)), cancellationToken); } /// /// Returns the first element of a sequence, or a default value if the sequence contains no elements. /// /// The type of the elements of . /// The to return the first element of. /// The cancellation token. /// /// default() if is empty; otherwise, the first element in . /// public static Task FirstOrDefaultAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, TSource>(Queryable.FirstOrDefault, source), source.Expression), cancellationToken); } /// /// Returns the first element of a sequence that satisfies a specified condition or a default value if no such element is found. /// /// The type of the elements of . /// An to return an element from. /// A function to test each element for a condition. /// The cancellation token. /// /// default() if is empty or if no element passes the test specified by ; otherwise, the first element in that passes the test specified by . /// public static Task FirstOrDefaultAsync(this IMongoQueryable source, Expression> predicate, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, TSource>(Queryable.FirstOrDefault, source, predicate), source.Expression, Expression.Quote(predicate)), cancellationToken); } /// /// Groups the elements of a sequence according to a specified key selector function. /// /// The type of the elements of . /// The type of the key returned by the function represented in keySelector. /// An whose elements to group. /// A function to extract the key for each element. /// /// An that has a type argument of /// and where each object contains a sequence of objects /// and a key. /// public static IMongoQueryable> GroupBy(this IMongoQueryable source, Expression> keySelector) { return (IMongoQueryable>)Queryable.GroupBy(source, keySelector); } /// /// Groups the elements of a sequence according to a specified key selector function /// and creates a result value from each group and its key. /// /// The type of the elements of . /// The type of the key returned by the function represented in keySelector. /// The type of the result value returned by resultSelector. /// An whose elements to group. /// A function to extract the key for each element. /// A function to create a result value from each group. /// /// An that has a type argument of TResult and where /// each element represents a projection over a group and its key. /// public static IMongoQueryable GroupBy(this IMongoQueryable source, Expression> keySelector, Expression, TResult>> resultSelector) { return (IMongoQueryable)Queryable.GroupBy(source, keySelector, resultSelector); } /// /// Correlates the elements of two sequences based on key equality and groups the results. /// /// The type of the elements of the first sequence. /// The type of the elements of the second sequence. /// The type of the keys returned by the key selector functions. /// The type of the result elements. /// The first sequence to join. /// The sequence to join to the first sequence. /// A function to extract the join key from each element of the first sequence. /// A function to extract the join key from each element of the second sequence. /// A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. /// /// An that contains elements of type obtained by performing a grouped join on two sequences. /// public static IMongoQueryable GroupJoin(this IMongoQueryable outer, IEnumerable inner, Expression> outerKeySelector, Expression> innerKeySelector, Expression, TResult>> resultSelector) { return (IMongoQueryable)Queryable.GroupJoin(outer, inner, outerKeySelector, innerKeySelector, resultSelector); } /// /// Correlates the elements of two sequences based on key equality and groups the results. /// /// The type of the elements of the first sequence. /// The type of the elements of the second sequence. /// The type of the keys returned by the key selector functions. /// The type of the result elements. /// The first sequence to join. /// The collection to join to the first sequence. /// A function to extract the join key from each element of the first sequence. /// A function to extract the join key from each element of the second sequence. /// A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. /// /// An that contains elements of type obtained by performing a grouped join on two sequences. /// public static IMongoQueryable GroupJoin(this IMongoQueryable outer, IMongoCollection inner, Expression> outerKeySelector, Expression> innerKeySelector, Expression, TResult>> resultSelector) { return GroupJoin(outer, inner.AsQueryable(), outerKeySelector, innerKeySelector, resultSelector); } /// /// Correlates the elements of two sequences based on matching keys. /// /// The type of the elements of the first sequence. /// The type of the elements of the second sequence. /// The type of the keys returned by the key selector functions. /// The type of the result elements. /// The first sequence to join. /// The sequence to join to the first sequence. /// A function to extract the join key from each element of the first sequence. /// A function to extract the join key from each element of the second sequence. /// A function to create a result element from two matching elements. /// /// An that has elements of type obtained by performing an inner join on two sequences. /// public static IMongoQueryable Join(this IMongoQueryable outer, IEnumerable inner, Expression> outerKeySelector, Expression> innerKeySelector, Expression> resultSelector) { return (IMongoQueryable)Queryable.Join(outer, inner.AsQueryable(), outerKeySelector, innerKeySelector, resultSelector); } /// /// Correlates the elements of two sequences based on matching keys. /// /// The type of the elements of the first sequence. /// The type of the elements of the second sequence. /// The type of the keys returned by the key selector functions. /// The type of the result elements. /// The first sequence to join. /// The sequence to join to the first sequence. /// A function to extract the join key from each element of the first sequence. /// A function to extract the join key from each element of the second sequence. /// A function to create a result element from two matching elements. /// /// An that has elements of type obtained by performing an inner join on two sequences. /// public static IMongoQueryable Join(this IMongoQueryable outer, IMongoCollection inner, Expression> outerKeySelector, Expression> innerKeySelector, Expression> resultSelector) { return Join(outer, inner.AsQueryable(), outerKeySelector, innerKeySelector, resultSelector); } /// /// Returns the number of elements in a sequence. /// /// The type of the elements of . /// The that contains the elements to be counted. /// The cancellation token. /// /// The number of elements in the input sequence. /// public static Task LongCountAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, long>(Queryable.LongCount, source), source.Expression), cancellationToken); } /// /// Returns the number of elements in the specified sequence that satisfies a condition. /// /// The type of the elements of . /// An that contains the elements to be counted. /// A function to test each element for a condition. /// The cancellation token. /// /// The number of elements in the sequence that satisfies the condition in the predicate function. /// public static Task LongCountAsync(this IMongoQueryable source, Expression> predicate, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, long>(Queryable.LongCount, source, predicate), source.Expression, Expression.Quote(predicate)), cancellationToken); } /// /// Returns the maximum value in a generic . /// /// The type of the elements of . /// A sequence of values to determine the maximum of. /// The cancellation token. /// /// The maximum value in the sequence. /// public static Task MaxAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, TSource>(Queryable.Max, source), source.Expression), cancellationToken); } /// /// Invokes a projection function on each element of a generic and returns the maximum resulting value. /// /// The type of the elements of . /// The type of the value returned by the function represented by . /// A sequence of values to determine the maximum of. /// A projection function to apply to each element. /// The cancellation token. /// /// The maximum value in the sequence. /// public static Task MaxAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, TResult>(Queryable.Max, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Returns the minimum value in a generic . /// /// The type of the elements of . /// A sequence of values to determine the minimum of. /// The cancellation token. /// /// The minimum value in the sequence. /// public static Task MinAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, TSource>(Queryable.Min, source), source.Expression), cancellationToken); } /// /// Invokes a projection function on each element of a generic and returns the minimum resulting value. /// /// The type of the elements of . /// The type of the value returned by the function represented by . /// A sequence of values to determine the minimum of. /// A projection function to apply to each element. /// The cancellation token. /// /// The minimum value in the sequence. /// public static Task MinAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, TResult>(Queryable.Min, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Filters the elements of an based on a specified type. /// /// The type to filter the elements of the sequence on. /// An whose elements to filter. /// /// A collection that contains the elements from that have type . /// public static IMongoQueryable OfType(this IMongoQueryable source) { return (IMongoQueryable)Queryable.OfType(source); } /// /// Sorts the elements of a sequence in ascending order according to a key. /// /// The type of the elements of . /// The type of the key returned by the function that is represented by keySelector. /// A sequence of values to order. /// A function to extract a key from an element. /// /// An whose elements are sorted according to a key. /// public static IOrderedMongoQueryable OrderBy(this IMongoQueryable source, Expression> keySelector) { return (IOrderedMongoQueryable)Queryable.OrderBy(source, keySelector); } /// /// Sorts the elements of a sequence in descending order according to a key. /// /// The type of the elements of . /// The type of the key returned by the function that is represented by keySelector. /// A sequence of values to order. /// A function to extract a key from an element. /// /// An whose elements are sorted in descending order according to a key. /// public static IOrderedMongoQueryable OrderByDescending(this IMongoQueryable source, Expression> keySelector) { return (IOrderedMongoQueryable)Queryable.OrderByDescending(source, keySelector); } /// /// Returns a sample of the elements in the . /// /// The type of the elements of . /// An to return a sample of. /// The number of elements in the sample. /// /// A sample of the elements in the . /// public static IMongoQueryable Sample(this IMongoQueryable source, long count) { return (IMongoQueryable)source.Provider.CreateQuery( Expression.Call( null, GetMethodInfo(Sample, source, count), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Constant(count))); } /// /// Projects each element of a sequence into a new form by incorporating the /// element's index. /// /// The type of the elements of . /// The type of the value returned by the function represented by selector. /// A sequence of values to project. /// A projection function to apply to each element. /// /// An whose elements are the result of invoking a /// projection function on each element of source. /// public static IMongoQueryable Select(this IMongoQueryable source, Expression> selector) { return (IMongoQueryable)Queryable.Select(source, selector); } /// /// Projects each element of a sequence to an and combines the resulting sequences into one sequence. /// /// The type of the elements of . /// The type of the elements of the sequence returned by the function represented by . /// A sequence of values to project. /// A projection function to apply to each element. /// /// An whose elements are the result of invoking a one-to-many projection function on each element of the input sequence. /// public static IMongoQueryable SelectMany(this IMongoQueryable source, Expression>> selector) { return (IMongoQueryable)Queryable.SelectMany(source, selector); } /// /// Projects each element of a sequence to an and /// invokes a result selector function on each element therein. The resulting values from /// each intermediate sequence are combined into a single, one-dimensional sequence and returned. /// /// The type of the elements of . /// The type of the intermediate elements collected by the function represented by . /// The type of the elements of the resulting sequence. /// A sequence of values to project. /// A projection function to apply to each element of the input sequence. /// A projection function to apply to each element of each intermediate sequence. /// /// An whose elements are the result of invoking the one-to-many projection function on each element of and then mapping each of those sequence elements and their corresponding element to a result element. /// public static IMongoQueryable SelectMany(this IMongoQueryable source, Expression>> collectionSelector, Expression> resultSelector) { return (IMongoQueryable)Queryable.SelectMany(source, collectionSelector, resultSelector); } /// /// Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence. /// /// The type of the elements of . /// An to return the single element of. /// The cancellation token. /// /// The single element of the input sequence. /// public static Task SingleAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, TSource>(Queryable.Single, source), source.Expression), cancellationToken); } /// /// Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists. /// /// The type of the elements of . /// An to return a single element from. /// A function to test an element for a condition. /// The cancellation token. /// /// The single element of the input sequence that satisfies the condition in . /// public static Task SingleAsync(this IMongoQueryable source, Expression> predicate, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, TSource>(Queryable.Single, source, predicate), source.Expression, Expression.Quote(predicate)), cancellationToken); } /// /// Returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence. /// /// The type of the elements of . /// An to return the single element of. /// The cancellation token. /// /// The single element of the input sequence, or default() if the sequence contains no elements. /// public static Task SingleOrDefaultAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, TSource>(Queryable.SingleOrDefault, source), source.Expression), cancellationToken); } /// /// Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. /// /// The type of the elements of . /// An to return a single element from. /// A function to test an element for a condition. /// The cancellation token. /// /// The single element of the input sequence that satisfies the condition in , or default() if no such element is found. /// public static Task SingleOrDefaultAsync(this IMongoQueryable source, Expression> predicate, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, TSource>(Queryable.SingleOrDefault, source, predicate), source.Expression, Expression.Quote(predicate)), cancellationToken); } /// /// Bypasses a specified number of elements in a sequence and then returns the /// remaining elements. /// /// The type of the elements of source /// An to return elements from. /// The number of elements to skip before returning the remaining elements. /// /// An that contains elements that occur after the /// specified index in the input sequence. /// public static IMongoQueryable Skip(this IMongoQueryable source, int count) { return (IMongoQueryable)Queryable.Skip(source, count); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static double StandardDeviationPopulation(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static double? StandardDeviationPopulation(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static double StandardDeviationPopulation(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static double? StandardDeviationPopulation(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static float StandardDeviationPopulation(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static float? StandardDeviationPopulation(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static double StandardDeviationPopulation(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static double? StandardDeviationPopulation(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static decimal StandardDeviationPopulation(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static decimal? StandardDeviationPopulation(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static double StandardDeviationPopulation(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static double? StandardDeviationPopulation(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static double StandardDeviationPopulation(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static double? StandardDeviationPopulation(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static float StandardDeviationPopulation(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static float? StandardDeviationPopulation(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static double StandardDeviationPopulation(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static double? StandardDeviationPopulation(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static decimal StandardDeviationPopulation(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static decimal? StandardDeviationPopulation(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the population standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationPopulationAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationPopulation, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static double StandardDeviationSample(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static double? StandardDeviationSample(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static double StandardDeviationSample(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static double? StandardDeviationSample(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static float StandardDeviationSample(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static float? StandardDeviationSample(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static double StandardDeviationSample(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static double? StandardDeviationSample(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static decimal StandardDeviationSample(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// /// The population standard deviation of the sequence of values. /// public static decimal? StandardDeviationSample(this IMongoQueryable source) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable)))); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static double StandardDeviationSample(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static double? StandardDeviationSample(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static double StandardDeviationSample(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static double? StandardDeviationSample(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static float StandardDeviationSample(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static float? StandardDeviationSample(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static double StandardDeviationSample(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static double? StandardDeviationSample(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static decimal StandardDeviationSample(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// /// The population standard deviation of the sequence of values. /// public static decimal? StandardDeviationSample(this IMongoQueryable source, Expression> selector) { return source.Provider.Execute( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector))); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values. /// /// A sequence of values to calculate the population standard deviation of. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source), Expression.Convert(source.Expression, typeof(IMongoQueryable))), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the sample standard deviation of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values to calculate the population standard deviation of. /// A transform function to apply to each element. /// The cancellation token. /// /// The population standard deviation of the sequence of values. /// public static Task StandardDeviationSampleAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo(StandardDeviationSample, source, selector), Expression.Convert(source.Expression, typeof(IMongoQueryable)), Expression.Quote(selector)), cancellationToken); } /// /// Computes the sum of a sequence of values. /// /// A sequence of values to calculate the sum of. /// The cancellation token. /// The sum of the values in the sequence. public static Task SumAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, decimal>(Queryable.Sum, source), source.Expression), cancellationToken); } /// /// Computes the sum of a sequence of values. /// /// A sequence of values to calculate the sum of. /// The cancellation token. /// The sum of the values in the sequence. public static Task SumAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, decimal?>(Queryable.Sum, source), source.Expression), cancellationToken); } /// /// Computes the sum of a sequence of values. /// /// A sequence of values to calculate the sum of. /// The cancellation token. /// The sum of the values in the sequence. public static Task SumAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, double>(Queryable.Sum, source), source.Expression), cancellationToken); } /// /// Computes the sum of a sequence of values. /// /// A sequence of values to calculate the sum of. /// The cancellation token. /// The sum of the values in the sequence. public static Task SumAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, double?>(Queryable.Sum, source), source.Expression), cancellationToken); } /// /// Computes the sum of a sequence of values. /// /// A sequence of values to calculate the sum of. /// The cancellation token. /// The sum of the values in the sequence. public static Task SumAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, float>(Queryable.Sum, source), source.Expression), cancellationToken); } /// /// Computes the sum of a sequence of values. /// /// A sequence of values to calculate the sum of. /// The cancellation token. /// The sum of the values in the sequence. public static Task SumAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, float?>(Queryable.Sum, source), source.Expression), cancellationToken); } /// /// Computes the sum of a sequence of values. /// /// A sequence of values to calculate the sum of. /// The cancellation token. /// The sum of the values in the sequence. public static Task SumAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, int>(Queryable.Sum, source), source.Expression), cancellationToken); } /// /// Computes the sum of a sequence of values. /// /// A sequence of values to calculate the sum of. /// The cancellation token. /// The sum of the values in the sequence. public static Task SumAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, int?>(Queryable.Sum, source), source.Expression), cancellationToken); } /// /// Computes the sum of a sequence of values. /// /// A sequence of values to calculate the sum of. /// The cancellation token. /// The sum of the values in the sequence. public static Task SumAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, long>(Queryable.Sum, source), source.Expression), cancellationToken); } /// /// Computes the sum of a sequence of values. /// /// A sequence of values to calculate the sum of. /// The cancellation token. /// The sum of the values in the sequence. public static Task SumAsync(this IMongoQueryable source, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, long?>(Queryable.Sum, source), source.Expression), cancellationToken); } /// /// Computes the sum of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The sum of the projected values. /// public static Task SumAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, decimal>(Queryable.Sum, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the sum of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The sum of the projected values. /// public static Task SumAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, decimal?>(Queryable.Sum, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the sum of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The sum of the projected values. /// public static Task SumAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, double>(Queryable.Sum, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the sum of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The sum of the projected values. /// public static Task SumAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, double?>(Queryable.Sum, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the sum of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The sum of the projected values. /// public static Task SumAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, float>(Queryable.Sum, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the sum of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The sum of the projected values. /// public static Task SumAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, float?>(Queryable.Sum, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the sum of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The sum of the projected values. /// public static Task SumAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, int>(Queryable.Sum, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the sum of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The sum of the projected values. /// public static Task SumAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, int?>(Queryable.Sum, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the sum of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The sum of the projected values. /// public static Task SumAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, long>(Queryable.Sum, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Computes the sum of the sequence of values that is obtained /// by invoking a projection function on each element of the input sequence. /// /// The type of the elements of . /// A sequence of values. /// A projection function to apply to each element. /// The cancellation token. /// /// The sum of the projected values. /// public static Task SumAsync(this IMongoQueryable source, Expression> selector, CancellationToken cancellationToken = default(CancellationToken)) { return ((IMongoQueryProvider)source.Provider).ExecuteAsync( Expression.Call( GetMethodInfo, Expression>, long?>(Queryable.Sum, source, selector), source.Expression, Expression.Quote(selector)), cancellationToken); } /// /// Returns a specified number of contiguous elements from the start of a sequence. /// /// The type of the elements of . /// The sequence to return elements from. /// The number of elements to return. /// /// An that contains the specified number of elements /// from the start of source. /// public static IMongoQueryable Take(this IMongoQueryable source, int count) { return (IMongoQueryable)Queryable.Take(source, count); } /// /// Performs a subsequent ordering of the elements in a sequence in ascending /// order according to a key. /// /// The type of the elements of . /// The type of the key returned by the function that is represented by keySelector. /// A sequence of values to order. /// A function to extract a key from an element. /// /// An whose elements are sorted according to a key. /// public static IOrderedMongoQueryable ThenBy(this IOrderedMongoQueryable source, Expression> keySelector) { return (IOrderedMongoQueryable)Queryable.ThenBy(source, keySelector); } /// /// Performs a subsequent ordering of the elements in a sequence in descending /// order according to a key. /// /// The type of the elements of . /// The type of the key returned by the function that is represented by keySelector. /// A sequence of values to order. /// A function to extract a key from an element. /// /// An whose elements are sorted in descending order according to a key. /// public static IOrderedMongoQueryable ThenByDescending(this IOrderedMongoQueryable source, Expression> keySelector) { return (IOrderedMongoQueryable)Queryable.ThenByDescending(source, keySelector); } /// /// Filters a sequence of values based on a predicate. /// /// The type of the elements of . /// An to return elements from. /// A function to test each element for a condition. /// /// An that contains elements from the input sequence /// that satisfy the condition specified by predicate. /// public static IMongoQueryable Where(this IMongoQueryable source, Expression> predicate) { return (IMongoQueryable)Queryable.Where(source, predicate); } private static MethodInfo GetMethodInfo(Func f, T1 unused) { return f.GetMethodInfo(); } private static MethodInfo GetMethodInfo(Func f, T1 unused1, T2 unused2) { return f.GetMethodInfo(); } } }