Class DynamicQueryableExtensions
Provides a set of static (Shared in Visual Basic) methods for querying data structures that implement System.Linq.IQueryable. It allows dynamic string based querying. Very handy when, at compile time, you don't know the type of queries that will be generated, or when downstream components only return column names to sort and filter by.
Inheritance
Inherited Members
Namespace: System.Linq.Dynamic.Core
Assembly: System.Linq.Dynamic.Core.dll
Syntax
public static class DynamicQueryableExtensions
Methods
| Improve this Doc View SourceAggregate(IQueryable, String, String)
Dynamically runs an aggregate function on the IQueryable.
Declaration
public static object Aggregate(this IQueryable source, string function, string member)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The IQueryable data source. |
System.String | function | The name of the function to run. Can be Sum, Average, Min or Max. |
System.String | member | The name of the property to aggregate over. |
Returns
Type | Description |
---|---|
System.Object | The value of the aggregate function run over the specified property. |
All(IQueryable, ParsingConfig, String, Object[])
Determines whether all the elements of a sequence satisfy a condition.
Declaration
[PublicAPI]
public static bool All(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence whose elements to test for a condition. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Boolean | true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false. |
All(IQueryable, String, Object[])
Determines whether all the elements of a sequence satisfy a condition.
Declaration
[PublicAPI]
public static bool All(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence whose elements to test for a condition. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Boolean | true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false. |
Any(IQueryable)
Determines whether a sequence contains any elements.
Declaration
public static bool Any(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence to check for being empty. |
Returns
Type | Description |
---|---|
System.Boolean | true if the source sequence contains any elements; otherwise, false. |
Examples
IQueryable queryable = employees.AsQueryable();
var result = queryable.Any();
|
Improve this Doc
View Source
Any(IQueryable, ParsingConfig, String, Object[])
Determines whether a sequence contains any elements.
Declaration
[PublicAPI]
public static bool Any(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence to check for being empty. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Boolean | true if the source sequence contains any elements; otherwise, false. |
Examples
IQueryable queryable = employees.AsQueryable();
var result1 = queryable.Any("Income > 50");
var result2 = queryable.Any("Income > @0", 50);
var result3 = queryable.Select("Roles.Any()");
|
Improve this Doc
View Source
Any(IQueryable, LambdaExpression)
Determines whether a sequence contains any elements.
Declaration
public static bool Any(this IQueryable source, LambdaExpression lambda)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence to check for being empty. |
System.Linq.Expressions.LambdaExpression | lambda | A cached Lambda Expression. |
Returns
Type | Description |
---|---|
System.Boolean | true if the source sequence contains any elements; otherwise, false. |
Any(IQueryable, String, Object[])
Determines whether a sequence contains any elements.
Declaration
public static bool Any(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Boolean | true if the source sequence contains any elements; otherwise, false. |
AsDynamicEnumerable(IQueryable)
Returns the input typed as System.Collections.Generic.IEnumerable<T> of System.Object./>
Declaration
public static IEnumerable<object> AsDynamicEnumerable(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The sequence to type as System.Collections.Generic.IEnumerable<T> of System.Object. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Object> | The input typed as System.Collections.Generic.IEnumerable<T> of System.Object. |
Average(IQueryable)
Computes the average of a sequence of numeric values.
Declaration
[PublicAPI]
public static double Average(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of numeric values to calculate the average of. |
Returns
Type | Description |
---|---|
System.Double | The average of the values in the sequence. |
Examples
IQueryable queryable = employees.AsQueryable();
var result1 = queryable.Average();
var result2 = queryable.Select("Roles.Average()");
|
Improve this Doc
View Source
Average(IQueryable, ParsingConfig, String, Object[])
Computes the average of a sequence of numeric values.
Declaration
[PublicAPI]
public static double Average(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of numeric values to calculate the average of. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Double | The average of the values in the sequence. |
Examples
IQueryable queryable = employees.AsQueryable();
var result = queryable.Average("Income");
|
Improve this Doc
View Source
Average(IQueryable, LambdaExpression)
Computes the average of a sequence of numeric values.
Declaration
[PublicAPI]
public static double Average(this IQueryable source, LambdaExpression lambda)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of numeric values to calculate the average of. |
System.Linq.Expressions.LambdaExpression | lambda | A Lambda Expression. |
Returns
Type | Description |
---|---|
System.Double | The average of the values in the sequence. |
Average(IQueryable, String, Object[])
Computes the average of a sequence of numeric values.
Declaration
[PublicAPI]
public static double Average(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Double | The average of the values in the sequence. |
Cast(IQueryable, ParsingConfig, String)
Converts the elements of an System.Linq.IQueryable to the specified type.
Declaration
public static IQueryable Cast(this IQueryable source, ParsingConfig config, string typeName)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable that contains the elements to be converted. |
ParsingConfig | config | The ParsingConfig. |
System.String | typeName | The type to convert the elements of source to. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable that contains each element of the source sequence converted to the specified type. |
Cast(IQueryable, String)
Converts the elements of an System.Linq.IQueryable to the specified type.
Declaration
public static IQueryable Cast(this IQueryable source, string typeName)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable that contains the elements to be converted. |
System.String | typeName | The type to convert the elements of source to. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable that contains each element of the source sequence converted to the specified type. |
Cast(IQueryable, Type)
Converts the elements of an System.Linq.IQueryable to the specified type.
Declaration
public static IQueryable Cast(this IQueryable source, Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable that contains the elements to be converted. |
System.Type | type | The type to convert the elements of source to. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable that contains each element of the source sequence converted to the specified type. |
Count(IQueryable)
Returns the number of elements in a sequence.
Declaration
public static int Count(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable that contains the elements to be counted. |
Returns
Type | Description |
---|---|
System.Int32 | The number of elements in the input sequence. |
Examples
IQueryable queryable = employees.AsQueryable();
var result = queryable.Count();
|
Improve this Doc
View Source
Count(IQueryable, ParsingConfig, String, Object[])
Returns the number of elements in a sequence.
Declaration
[PublicAPI]
public static int Count(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable that contains the elements to be counted. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Int32 | The number of elements in the specified sequence that satisfies a condition. |
Examples
IQueryable queryable = employees.AsQueryable();
var result1 = queryable.Count("Income > 50");
var result2 = queryable.Count("Income > @0", 50);
var result3 = queryable.Select("Roles.Count()");
|
Improve this Doc
View Source
Count(IQueryable, LambdaExpression)
Returns the number of elements in a sequence.
Declaration
public static int Count(this IQueryable source, LambdaExpression lambda)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable that contains the elements to be counted. |
System.Linq.Expressions.LambdaExpression | lambda | A cached Lambda Expression. |
Returns
Type | Description |
---|---|
System.Int32 | The number of elements in the specified sequence that satisfies a condition. |
Count(IQueryable, String, Object[])
Returns the number of elements in a sequence.
Declaration
public static int Count(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Int32 | The number of elements in the specified sequence that satisfies a condition. |
DefaultIfEmpty(IQueryable)
Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty.
Declaration
public static IQueryable DefaultIfEmpty(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return a default value for if empty. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable that contains default if source is empty; otherwise, source. |
Examples
IQueryable queryable = employees.DefaultIfEmpty();
|
Improve this Doc
View Source
DefaultIfEmpty(IQueryable, Object)
Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty.
Declaration
public static IQueryable DefaultIfEmpty(this IQueryable source, object defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return a default value for if empty. |
System.Object | defaultValue | The value to return if the sequence is empty. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable that contains defaultValue if source is empty; otherwise, source. |
Examples
IQueryable queryable = employees.DefaultIfEmpty(new Employee());
|
Improve this Doc
View Source
Distinct(IQueryable)
Returns distinct elements from a sequence by using the default equality comparer to compare values.
Declaration
public static IQueryable Distinct(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The sequence to remove duplicate elements from. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable that contains distinct elements from the source sequence. |
Examples
IQueryable queryable = employees.AsQueryable();
var result1 = queryable.Distinct();
var result2 = queryable.Select("Roles.Distinct()");
|
Improve this Doc
View Source
First(IQueryable)
Returns the first element of a sequence.
Declaration
public static object First(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return the first element of. |
Returns
Type | Description |
---|---|
System.Object | The first element in source. |
First(IQueryable, ParsingConfig, String, Object[])
Returns the first element of a sequence that satisfies a specified condition.
Declaration
[PublicAPI]
public static object First(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return the first element of. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Object | The first element in source that passes the test in predicate. |
First(IQueryable, LambdaExpression)
Returns the first element of a sequence that satisfies a specified condition.
Declaration
public static object First(this IQueryable source, LambdaExpression lambda)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return the first element of. |
System.Linq.Expressions.LambdaExpression | lambda | A cached Lambda Expression. |
Returns
Type | Description |
---|---|
System.Object | The first element in source that passes the test in predicate. |
First(IQueryable, String, Object[])
Returns the first element of a sequence that satisfies a specified condition.
Declaration
public static object First(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Object | The first element in source that passes the test in predicate. |
FirstOrDefault(IQueryable)
Returns the first element of a sequence, or a default value if the sequence contains no elements.
Declaration
public static object FirstOrDefault(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return the first element of. |
Returns
Type | Description |
---|---|
System.Object | default if source is empty; otherwise, the first element in source. |
FirstOrDefault(IQueryable, ParsingConfig, String, Object[])
Returns the first element of a sequence that satisfies a specified condition or a default value if no such element is found.
Declaration
[PublicAPI]
public static object FirstOrDefault(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return the first element of. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Object | default if source is empty or if no element passes the test specified by predicate; otherwise, the first element in source that passes the test specified by predicate. |
FirstOrDefault(IQueryable, LambdaExpression)
Returns the first element of a sequence that satisfies a specified condition or a default value if no such element is found.
Declaration
public static object FirstOrDefault(this IQueryable source, LambdaExpression lambda)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return the first element of. |
System.Linq.Expressions.LambdaExpression | lambda | A cached Lambda Expression. |
Returns
Type | Description |
---|---|
System.Object | default if source is empty or if no element passes the test specified by predicate; otherwise, the first element in source that passes the test specified by predicate. |
FirstOrDefault(IQueryable, String, Object[])
Returns the first element of a sequence that satisfies a specified condition or a default value if no such element is found.
Declaration
public static object FirstOrDefault(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Object | default if source is empty or if no element passes the test specified by predicate; otherwise, the first element in source that passes the test specified by predicate. |
GroupBy(IQueryable, ParsingConfig, String, IEqualityComparer, Object[])
Groups the elements of a sequence according to a specified key string function and creates a result value from each group and its key.
Declaration
public static IQueryable GroupBy(this IQueryable source, ParsingConfig config, string keySelector, IEqualityComparer equalityComparer, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A System.Linq.IQueryable whose elements to group. |
ParsingConfig | config | The ParsingConfig. |
System.String | keySelector | A string expression to specify the key for each element. |
System.Collections.IEqualityComparer | equalityComparer | The comparer to use. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable where each element represents a projection over a group and its key. |
GroupBy(IQueryable, ParsingConfig, String, Object[])
Groups the elements of a sequence according to a specified key string function and creates a result value from each group and its key.
Declaration
[PublicAPI]
public static IQueryable GroupBy(this IQueryable source, ParsingConfig config, string keySelector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A System.Linq.IQueryable whose elements to group. |
ParsingConfig | config | The ParsingConfig. |
System.String | keySelector | A string expression to specify the key for each element. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable where each element represents a projection over a group and its key. |
Examples
var groupResult1 = queryable.GroupBy("NumberPropertyAsKey");
var groupResult2 = queryable.GroupBy("new (NumberPropertyAsKey, StringPropertyAsKey)");
|
Improve this Doc
View Source
GroupBy(IQueryable, ParsingConfig, String, String)
Groups the elements of a sequence according to a specified key string function and creates a result value from each group and its key.
Declaration
public static IQueryable GroupBy(this IQueryable source, ParsingConfig config, string keySelector, string resultSelector)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A System.Linq.IQueryable whose elements to group. |
ParsingConfig | config | The ParsingConfig. |
System.String | keySelector | A string expression to specify the key for each element. |
System.String | resultSelector | A string expression to specify a result value from each group. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable where each element represents a projection over a group and its key. |
Examples
var groupResult1 = queryable.GroupBy("NumberPropertyAsKey", "StringProperty");
var groupResult2 = queryable.GroupBy("new (NumberPropertyAsKey, StringPropertyAsKey)", "new (StringProperty1, StringProperty2)");
|
Improve this Doc
View Source
GroupBy(IQueryable, ParsingConfig, String, String, IEqualityComparer)
Groups the elements of a sequence according to a specified key string function and creates a result value from each group and its key.
Declaration
public static IQueryable GroupBy(this IQueryable source, ParsingConfig config, string keySelector, string resultSelector, IEqualityComparer equalityComparer)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A System.Linq.IQueryable whose elements to group. |
ParsingConfig | config | The ParsingConfig. |
System.String | keySelector | A string expression to specify the key for each element. |
System.String | resultSelector | A string expression to specify a result value from each group. |
System.Collections.IEqualityComparer | equalityComparer | The comparer to use. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable where each element represents a projection over a group and its key. |
GroupBy(IQueryable, ParsingConfig, String, String, IEqualityComparer, Object[])
Groups the elements of a sequence according to a specified key string function and creates a result value from each group and its key.
Declaration
public static IQueryable GroupBy(this IQueryable source, ParsingConfig config, string keySelector, string resultSelector, IEqualityComparer equalityComparer, object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A System.Linq.IQueryable whose elements to group. |
ParsingConfig | config | The ParsingConfig. |
System.String | keySelector | A string expression to specify the key for each element. |
System.String | resultSelector | A string expression to specify a result value from each group. |
System.Collections.IEqualityComparer | equalityComparer | The comparer to use. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable where each element represents a projection over a group and its key. |
GroupBy(IQueryable, ParsingConfig, String, String, Object[])
Groups the elements of a sequence according to a specified key string function and creates a result value from each group and its key.
Declaration
[PublicAPI]
public static IQueryable GroupBy(this IQueryable source, ParsingConfig config, string keySelector, string resultSelector, object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A System.Linq.IQueryable whose elements to group. |
ParsingConfig | config | The ParsingConfig. |
System.String | keySelector | A string expression to specify the key for each element. |
System.String | resultSelector | A string expression to specify a result value from each group. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable where each element represents a projection over a group and its key. |
Examples
var groupResult1 = queryable.GroupBy("NumberPropertyAsKey", "StringProperty");
var groupResult2 = queryable.GroupBy("new (NumberPropertyAsKey, StringPropertyAsKey)", "new (StringProperty1, StringProperty2)");
|
Improve this Doc
View Source
GroupBy(IQueryable, String, IEqualityComparer, Object[])
Groups the elements of a sequence according to a specified key string function and creates a result value from each group and its key.
Declaration
public static IQueryable GroupBy(this IQueryable source, string keySelector, IEqualityComparer equalityComparer, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | keySelector | |
System.Collections.IEqualityComparer | equalityComparer | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable where each element represents a projection over a group and its key. |
GroupBy(IQueryable, String, Object[])
Groups the elements of a sequence according to a specified key string function and creates a result value from each group and its key.
Declaration
[PublicAPI]
public static IQueryable GroupBy(this IQueryable source, string keySelector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | keySelector | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable where each element represents a projection over a group and its key. |
GroupBy(IQueryable, String, String)
Groups the elements of a sequence according to a specified key string function and creates a result value from each group and its key.
Declaration
public static IQueryable GroupBy(this IQueryable source, string keySelector, string resultSelector)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | keySelector | |
System.String | resultSelector |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable where each element represents a projection over a group and its key. |
GroupBy(IQueryable, String, String, IEqualityComparer)
Groups the elements of a sequence according to a specified key string function and creates a result value from each group and its key.
Declaration
public static IQueryable GroupBy(this IQueryable source, string keySelector, string resultSelector, IEqualityComparer equalityComparer)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | keySelector | |
System.String | resultSelector | |
System.Collections.IEqualityComparer | equalityComparer |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable where each element represents a projection over a group and its key. |
GroupBy(IQueryable, String, String, IEqualityComparer, Object[])
Groups the elements of a sequence according to a specified key string function and creates a result value from each group and its key.
Declaration
public static IQueryable GroupBy(this IQueryable source, string keySelector, string resultSelector, IEqualityComparer equalityComparer, object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | keySelector | |
System.String | resultSelector | |
System.Collections.IEqualityComparer | equalityComparer | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable where each element represents a projection over a group and its key. |
GroupBy(IQueryable, String, String, Object[])
Groups the elements of a sequence according to a specified key string function and creates a result value from each group and its key.
Declaration
[PublicAPI]
public static IQueryable GroupBy(this IQueryable source, string keySelector, string resultSelector, object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | keySelector | |
System.String | resultSelector | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable where each element represents a projection over a group and its key. |
GroupByMany<TElement>(IEnumerable<TElement>, Func<TElement, Object>[])
Groups the elements of a sequence according to multiple specified key functions and creates a result value from each group (and subgroups) and its key.
Declaration
public static IEnumerable<GroupResult> GroupByMany<TElement>(this IEnumerable<TElement> source, params Func<TElement, object>[] keySelectors)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TElement> | source | A System.Collections.Generic.IEnumerable<T> whose elements to group. |
System.Func<TElement, System.Object>[] | keySelectors | Lambda expressions to specify the keys for each element. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<GroupResult> | A System.Collections.Generic.IEnumerable<T> of type GroupResult where each element represents a projection over a group, its key, and its subgroups. |
Type Parameters
Name | Description |
---|---|
TElement |
GroupByMany<TElement>(IEnumerable<TElement>, ParsingConfig, String[])
Groups the elements of a sequence according to multiple specified key string functions and creates a result value from each group (and subgroups) and its key.
Declaration
public static IEnumerable<GroupResult> GroupByMany<TElement>(this IEnumerable<TElement> source, ParsingConfig config, params string[] keySelectors)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TElement> | source | A System.Collections.Generic.IEnumerable<T> whose elements to group. |
ParsingConfig | config | The ParsingConfig. |
System.String[] | keySelectors | System.String expressions to specify the keys for each element. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<GroupResult> | A System.Collections.Generic.IEnumerable<T> of type GroupResult where each element represents a projection over a group, its key, and its subgroups. |
Type Parameters
Name | Description |
---|---|
TElement |
GroupByMany<TElement>(IEnumerable<TElement>, String[])
Groups the elements of a sequence according to multiple specified key string functions and creates a result value from each group (and subgroups) and its key.
Declaration
public static IEnumerable<GroupResult> GroupByMany<TElement>(this IEnumerable<TElement> source, params string[] keySelectors)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TElement> | source | |
System.String[] | keySelectors |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<GroupResult> | A System.Collections.Generic.IEnumerable<T> of type GroupResult where each element represents a projection over a group, its key, and its subgroups. |
Type Parameters
Name | Description |
---|---|
TElement |
GroupJoin(IQueryable, IEnumerable, String, String, String, Object[])
Correlates the elements of two sequences based on equality of keys and groups the results. The default equality comparer is used to compare keys.
Declaration
public static IQueryable GroupJoin(this IQueryable outer, IEnumerable inner, string outerKeySelector, string innerKeySelector, string resultSelector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | outer | |
System.Collections.IEnumerable | inner | |
System.String | outerKeySelector | |
System.String | innerKeySelector | |
System.String | resultSelector | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable obtained by performing a grouped join on two sequences. |
GroupJoin(IQueryable, ParsingConfig, IEnumerable, String, String, String, Object[])
Correlates the elements of two sequences based on equality of keys and groups the results. The default equality comparer is used to compare keys.
Declaration
public static IQueryable GroupJoin(this IQueryable outer, ParsingConfig config, IEnumerable inner, string outerKeySelector, string innerKeySelector, string resultSelector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | outer | The first sequence to join. |
ParsingConfig | config | The ParsingConfig. |
System.Collections.IEnumerable | inner | The sequence to join to the first sequence. |
System.String | outerKeySelector | A dynamic function to extract the join key from each element of the first sequence. |
System.String | innerKeySelector | A dynamic function to extract the join key from each element of the second sequence. |
System.String | resultSelector | A dynamic function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicates as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable obtained by performing a grouped join on two sequences. |
Join(IQueryable, IEnumerable, String, String, String, Object[])
Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.
Declaration
public static IQueryable Join(this IQueryable outer, IEnumerable inner, string outerKeySelector, string innerKeySelector, string resultSelector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | outer | |
System.Collections.IEnumerable | inner | |
System.String | outerKeySelector | |
System.String | innerKeySelector | |
System.String | resultSelector | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable obtained by performing an inner join on two sequences. |
Join(IQueryable, ParsingConfig, IEnumerable, String, String, String, Object[])
Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.
Declaration
public static IQueryable Join(this IQueryable outer, ParsingConfig config, IEnumerable inner, string outerKeySelector, string innerKeySelector, string resultSelector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | outer | The first sequence to join. |
ParsingConfig | config | The ParsingConfig. |
System.Collections.IEnumerable | inner | The sequence to join to the first sequence. |
System.String | outerKeySelector | A dynamic function to extract the join key from each element of the first sequence. |
System.String | innerKeySelector | A dynamic function to extract the join key from each element of the second sequence. |
System.String | resultSelector | A dynamic function to create a result element from two matching elements. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicates as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable obtained by performing an inner join on two sequences. |
Join<TElement>(IQueryable<TElement>, IEnumerable<TElement>, String, String, String, Object[])
Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.
Declaration
public static IQueryable<TElement> Join<TElement>(this IQueryable<TElement> outer, IEnumerable<TElement> inner, string outerKeySelector, string innerKeySelector, string resultSelector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TElement> | outer | |
System.Collections.Generic.IEnumerable<TElement> | inner | |
System.String | outerKeySelector | |
System.String | innerKeySelector | |
System.String | resultSelector | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable<TElement> | An System.Linq.IQueryable<T> that has elements of type TResult obtained by performing an inner join on two sequences. |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements of both sequences, and the result. |
Remarks
This overload only works on elements where both sequences and the resulting element match.
Join<TElement>(IQueryable<TElement>, ParsingConfig, IEnumerable<TElement>, String, String, String, Object[])
Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.
Declaration
public static IQueryable<TElement> Join<TElement>(this IQueryable<TElement> outer, ParsingConfig config, IEnumerable<TElement> inner, string outerKeySelector, string innerKeySelector, string resultSelector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TElement> | outer | The first sequence to join. |
ParsingConfig | config | The ParsingConfig. |
System.Collections.Generic.IEnumerable<TElement> | inner | The sequence to join to the first sequence. |
System.String | outerKeySelector | A dynamic function to extract the join key from each element of the first sequence. |
System.String | innerKeySelector | A dynamic function to extract the join key from each element of the second sequence. |
System.String | resultSelector | A dynamic function to create a result element from two matching elements. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicates as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable<TElement> | An System.Linq.IQueryable<T> that has elements of type TResult obtained by performing an inner join on two sequences. |
Type Parameters
Name | Description |
---|---|
TElement | The type of the elements of both sequences, and the result. |
Remarks
This overload only works on elements where both sequences and the resulting element match.
Last(IQueryable)
Returns the last element of a sequence.
Declaration
public static object Last(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return the last element of. |
Returns
Type | Description |
---|---|
System.Object | The last element in source. |
Last(IQueryable, ParsingConfig, String, Object[])
Returns the last element of a sequence that satisfies a specified condition.
Declaration
public static object Last(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return the last element of. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Object | The first element in source that passes the test in predicate. |
Last(IQueryable, LambdaExpression)
Returns the last element of a sequence that satisfies a specified condition.
Declaration
public static object Last(this IQueryable source, LambdaExpression lambda)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return the last element of. |
System.Linq.Expressions.LambdaExpression | lambda | A cached Lambda Expression. |
Returns
Type | Description |
---|---|
System.Object | The first element in source that passes the test in predicate. |
Last(IQueryable, String, Object[])
Returns the last element of a sequence that satisfies a specified condition.
Declaration
public static object Last(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Object | The first element in source that passes the test in predicate. |
LastOrDefault(IQueryable)
Returns the last element of a sequence, or a default value if the sequence contains no elements.
Declaration
public static object LastOrDefault(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return the last element of. |
Returns
Type | Description |
---|---|
System.Object | default if source is empty; otherwise, the last element in source. |
LastOrDefault(IQueryable, ParsingConfig, String, Object[])
Returns the last element of a sequence that satisfies a specified condition, or a default value if the sequence contains no elements.
Declaration
public static object LastOrDefault(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return the last element of. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Object | The first element in source that passes the test in predicate. |
LastOrDefault(IQueryable, LambdaExpression)
Returns the last element of a sequence that satisfies a specified condition, or a default value if the sequence contains no elements.
Declaration
public static object LastOrDefault(this IQueryable source, LambdaExpression lambda)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return the last element of. |
System.Linq.Expressions.LambdaExpression | lambda | A cached Lambda Expression. |
Returns
Type | Description |
---|---|
System.Object | The first element in source that passes the test in predicate. |
LastOrDefault(IQueryable, String, Object[])
Returns the last element of a sequence that satisfies a specified condition, or a default value if the sequence contains no elements.
Declaration
public static object LastOrDefault(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Object | The first element in source that passes the test in predicate. |
LongCount(IQueryable)
Returns the number of elements in a sequence.
Declaration
public static long LongCount(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable that contains the elements to be counted. |
Returns
Type | Description |
---|---|
System.Int64 | The number of elements in the input sequence. |
Examples
IQueryable queryable = employees.AsQueryable();
var result = queryable.LongCount();
|
Improve this Doc
View Source
LongCount(IQueryable, ParsingConfig, String, Object[])
Returns the number of elements in a sequence.
Declaration
[PublicAPI]
public static long LongCount(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable that contains the elements to be counted. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Int64 | The number of elements in the specified sequence that satisfies a condition. |
Examples
IQueryable queryable = employees.AsQueryable();
var result1 = queryable.LongCount("Income > 50");
var result2 = queryable.LongCount("Income > @0", 50);
var result3 = queryable.Select("Roles.LongCount()");
|
Improve this Doc
View Source
LongCount(IQueryable, LambdaExpression)
Returns the number of elements in a sequence.
Declaration
public static long LongCount(this IQueryable source, LambdaExpression lambda)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable that contains the elements to be counted. |
System.Linq.Expressions.LambdaExpression | lambda | A cached Lambda Expression. |
Returns
Type | Description |
---|---|
System.Int64 | The number of elements in the specified sequence that satisfies a condition. |
LongCount(IQueryable, String, Object[])
Returns the number of elements in a sequence.
Declaration
public static long LongCount(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Int64 | The number of elements in the specified sequence that satisfies a condition. |
Max(IQueryable)
Computes the max element of a sequence.
Declaration
[PublicAPI]
public static object Max(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to calculate find the max for. |
Returns
Type | Description |
---|---|
System.Object | The max element in the sequence. |
Examples
IQueryable queryable = employees.AsQueryable();
var result1 = queryable.Max();
var result2 = queryable.Select("Roles.Max()");
|
Improve this Doc
View Source
Max(IQueryable, ParsingConfig, String, Object[])
Computes the max element of a sequence.
Declaration
[PublicAPI]
public static object Max(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to calculate find the max for. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Object | The max element in the sequence. |
Examples
IQueryable queryable = employees.AsQueryable();
var result = queryable.Max("Income");
|
Improve this Doc
View Source
Max(IQueryable, LambdaExpression)
Computes the max element of a sequence.
Declaration
[PublicAPI]
public static object Max(this IQueryable source, LambdaExpression lambda)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to calculate find the max for. |
System.Linq.Expressions.LambdaExpression | lambda | A Lambda Expression. |
Returns
Type | Description |
---|---|
System.Object | The max element in the sequence. |
Max(IQueryable, String, Object[])
Computes the max element of a sequence.
Declaration
[PublicAPI]
public static object Max(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Object | The max element in the sequence. |
Min(IQueryable)
Computes the min element of a sequence.
Declaration
[PublicAPI]
public static object Min(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to calculate find the min for. |
Returns
Type | Description |
---|---|
System.Object | The min element in the sequence. |
Examples
IQueryable queryable = employees.AsQueryable();
var result1 = queryable.Min();
var result2 = queryable.Select("Roles.Min()");
|
Improve this Doc
View Source
Min(IQueryable, ParsingConfig, String, Object[])
Computes the min element of a sequence.
Declaration
[PublicAPI]
public static object Min(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to calculate find the min for. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Object | The min element in the sequence. |
Examples
IQueryable queryable = employees.AsQueryable();
var result = queryable.Min("Income");
|
Improve this Doc
View Source
Min(IQueryable, LambdaExpression)
Computes the min element of a sequence.
Declaration
[PublicAPI]
public static object Min(this IQueryable source, LambdaExpression lambda)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to calculate find the min for. |
System.Linq.Expressions.LambdaExpression | lambda | A Lambda Expression. |
Returns
Type | Description |
---|---|
System.Object | The min element in the sequence. |
Min(IQueryable, String, Object[])
Computes the min element of a sequence.
Declaration
[PublicAPI]
public static object Min(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Object | The min element in the sequence. |
OfType(IQueryable, ParsingConfig, String)
Filters the elements of an System.Linq.IQueryable based on a specified type.
Declaration
public static IQueryable OfType(this IQueryable source, ParsingConfig config, string typeName)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | An System.Linq.IQueryable whose elements to filter. |
ParsingConfig | config | The ParsingConfig. |
System.String | typeName | The type to filter the elements of the sequence on. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A collection that contains the elements from source that have the type. |
OfType(IQueryable, String)
Filters the elements of an System.Linq.IQueryable based on a specified type.
Declaration
public static IQueryable OfType(this IQueryable source, string typeName)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | An System.Linq.IQueryable whose elements to filter. |
System.String | typeName | The type to filter the elements of the sequence on. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A collection that contains the elements from source that have the type. |
OfType(IQueryable, Type)
Filters the elements of an System.Linq.IQueryable based on a specified type.
Declaration
public static IQueryable OfType(this IQueryable source, Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | An System.Linq.IQueryable whose elements to filter. |
System.Type | type | The type to filter the elements of the sequence on. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A collection that contains the elements from source that have the type. |
OrderBy(IQueryable, ParsingConfig, String, IComparer, Object[])
Sorts the elements of a sequence in ascending or descending order according to a key.
Declaration
public static IOrderedQueryable OrderBy(this IQueryable source, ParsingConfig config, string ordering, IComparer comparer, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to order. |
ParsingConfig | config | The ParsingConfig. |
System.String | ordering | An expression string to indicate values to order by. |
System.Collections.IComparer | comparer | The comparer to use. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable | A System.Linq.IQueryable whose elements are sorted according to the specified |
OrderBy(IQueryable, ParsingConfig, String, Object[])
Sorts the elements of a sequence in ascending or descending order according to a key.
Declaration
public static IOrderedQueryable OrderBy(this IQueryable source, ParsingConfig config, string ordering, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to order. |
ParsingConfig | config | The ParsingConfig. |
System.String | ordering | An expression string to indicate values to order by. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable | A System.Linq.IQueryable whose elements are sorted according to the specified |
Examples
var resultSingle = queryable.OrderBy("NumberProperty");
var resultSingleDescending = queryable.OrderBy("NumberProperty DESC");
var resultMultiple = queryable.OrderBy("NumberProperty, StringProperty DESC");
|
Improve this Doc
View Source
OrderBy(IQueryable, String, IComparer, Object[])
Sorts the elements of a sequence in ascending or descending order according to a key.
Declaration
public static IOrderedQueryable OrderBy(this IQueryable source, string ordering, IComparer comparer, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | ordering | |
System.Collections.IComparer | comparer | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable | A System.Linq.IQueryable whose elements are sorted according to the specified |
OrderBy(IQueryable, String, Object[])
Sorts the elements of a sequence in ascending or descending order according to a key.
Declaration
public static IOrderedQueryable OrderBy(this IQueryable source, string ordering, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | ordering | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable | A System.Linq.IQueryable whose elements are sorted according to the specified |
OrderBy<TSource>(IQueryable<TSource>, ParsingConfig, String, IComparer, Object[])
Sorts the elements of a sequence in ascending or descending order according to a key.
Declaration
public static IOrderedQueryable<TSource> OrderBy<TSource>(this IQueryable<TSource> source, ParsingConfig config, string ordering, IComparer comparer, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | A sequence of values to order. |
ParsingConfig | config | The ParsingConfig. |
System.String | ordering | An expression string to indicate values to order by. |
System.Collections.IComparer | comparer | The comparer to use. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable<TSource> | A System.Linq.IQueryable<T> whose elements are sorted according to the specified |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
OrderBy<TSource>(IQueryable<TSource>, ParsingConfig, String, Object[])
Sorts the elements of a sequence in ascending or descending order according to a key.
Declaration
public static IOrderedQueryable<TSource> OrderBy<TSource>(this IQueryable<TSource> source, ParsingConfig config, string ordering, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | A sequence of values to order. |
ParsingConfig | config | The ParsingConfig. |
System.String | ordering | An expression string to indicate values to order by. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable<TSource> | A System.Linq.IQueryable<T> whose elements are sorted according to the specified |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
Examples
var resultSingle = queryable.OrderBy<User>("NumberProperty");
var resultSingleDescending = queryable.OrderBy<User>("NumberProperty DESC");
var resultMultiple = queryable.OrderBy<User>("NumberProperty, StringProperty");
|
Improve this Doc
View Source
OrderBy<TSource>(IQueryable<TSource>, String, IComparer, Object[])
Sorts the elements of a sequence in ascending or descending order according to a key.
Declaration
public static IOrderedQueryable<TSource> OrderBy<TSource>(this IQueryable<TSource> source, string ordering, IComparer comparer, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | A sequence of values to order. |
System.String | ordering | An expression string to indicate values to order by. |
System.Collections.IComparer | comparer | The comparer to use. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable<TSource> | A System.Linq.IQueryable<T> whose elements are sorted according to the specified |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
OrderBy<TSource>(IQueryable<TSource>, String, Object[])
Sorts the elements of a sequence in ascending or descending order according to a key.
Declaration
public static IOrderedQueryable<TSource> OrderBy<TSource>(this IQueryable<TSource> source, string ordering, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | |
System.String | ordering | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable<TSource> | A System.Linq.IQueryable<T> whose elements are sorted according to the specified |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
Page(IQueryable, Int32, Int32)
Returns the elements as paged.
Declaration
public static IQueryable Page(this IQueryable source, int page, int pageSize)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The IQueryable to return elements from. |
System.Int32 | page | The page to return. |
System.Int32 | pageSize | The number of elements per page. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable that contains the paged elements. |
Page<TSource>(IQueryable<TSource>, Int32, Int32)
Returns the elements as paged.
Declaration
public static IQueryable<TSource> Page<TSource>(this IQueryable<TSource> source, int page, int pageSize)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | The IQueryable to return elements from. |
System.Int32 | page | The page to return. |
System.Int32 | pageSize | The number of elements per page. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable<TSource> | A System.Linq.IQueryable<T> that contains the paged elements. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the source. |
PageResult(IQueryable, Int32, Int32, Nullable<Int32>)
Returns the elements as paged and include the CurrentPage, PageCount, PageSize and RowCount.
Declaration
public static PagedResult PageResult(this IQueryable source, int page, int pageSize, int? rowCount = null)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The IQueryable to return elements from. |
System.Int32 | page | The page to return. |
System.Int32 | pageSize | The number of elements per page. |
System.Nullable<System.Int32> | rowCount | If this optional parameter has been defined, this value is used as the RowCount instead of executing a Linq |
Returns
Type | Description |
---|---|
PagedResult | PagedResult |
PageResult<TSource>(IQueryable<TSource>, Int32, Int32, Nullable<Int32>)
Returns the elements as paged and include the CurrentPage, PageCount, PageSize and RowCount.
Declaration
public static PagedResult<TSource> PageResult<TSource>(this IQueryable<TSource> source, int page, int pageSize, int? rowCount = null)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | The IQueryable to return elements from. |
System.Int32 | page | The page to return. |
System.Int32 | pageSize | The number of elements per page. |
System.Nullable<System.Int32> | rowCount | If this optional parameter has been defined, this value is used as the RowCount instead of executing a Linq |
Returns
Type | Description |
---|---|
PagedResult<TSource> | PagedResult{TSource} |
Type Parameters
Name | Description |
---|---|
TSource | The type of the source. |
Reverse(IQueryable)
Inverts the order of the elements in a sequence.
Declaration
public static IQueryable Reverse(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to reverse. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable whose elements correspond to those of the input sequence in reverse order. |
Select(IQueryable, ParsingConfig, String, Object[])
Projects each element of a sequence into a new form.
Declaration
public static IQueryable Select(this IQueryable source, ParsingConfig config, string selector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to project. |
ParsingConfig | config | The ParsingConfig. |
System.String | selector | A projection string expression to apply to each element. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable whose elements are the result of invoking a projection string on each element of source. |
Examples
var singleField = queryable.Select("StringProperty");
var dynamicObject = queryable.Select("new (StringProperty1, StringProperty2 as OtherStringPropertyName)");
|
Improve this Doc
View Source
Select(IQueryable, ParsingConfig, Type, String, Object[])
Projects each element of a sequence into a new class of type TResult. Details see http://solutionizing.net/category/linq/
Declaration
public static IQueryable Select(this IQueryable source, ParsingConfig config, Type resultType, string selector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to project. |
ParsingConfig | config | The ParsingConfig. |
System.Type | resultType | The result type. |
System.String | selector | A projection string expression to apply to each element. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable whose elements are the result of invoking a projection string on each element of source. |
Examples
var users = queryable.Select(typeof(User), "new (Username, Pwd as Password)");
|
Improve this Doc
View Source
Select(IQueryable, String, Object[])
Projects each element of a sequence into a new form.
Declaration
public static IQueryable Select(this IQueryable source, string selector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | selector | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable whose elements are the result of invoking a projection string on each element of source. |
Select(IQueryable, Type, String, Object[])
Projects each element of a sequence into a new class of type TResult. Details see http://solutionizing.net/category/linq/
Declaration
public static IQueryable Select(this IQueryable source, Type resultType, string selector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.Type | resultType | |
System.String | selector | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable whose elements are the result of invoking a projection string on each element of source. |
Select<TResult>(IQueryable, ParsingConfig, String, Object[])
Projects each element of a sequence into a new class of type TResult. Details see http://solutionizing.net/category/linq/.
Declaration
public static IQueryable<TResult> Select<TResult>(this IQueryable source, ParsingConfig config, string selector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to project. |
ParsingConfig | config | The ParsingConfig. |
System.String | selector | A projection string expression to apply to each element. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable<TResult> | An System.Linq.IQueryable<T> whose elements are the result of invoking a projection string on each element of source. |
Type Parameters
Name | Description |
---|---|
TResult | The type of the result. |
Examples
var users = queryable.Select<User>("new (Username, Pwd as Password)");
|
Improve this Doc
View Source
Select<TResult>(IQueryable, String, Object[])
Projects each element of a sequence into a new class of type TResult. Details see http://solutionizing.net/category/linq/.
Declaration
public static IQueryable<TResult> Select<TResult>(this IQueryable source, string selector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | selector | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable<TResult> | An System.Linq.IQueryable<T> whose elements are the result of invoking a projection string on each element of source. |
Type Parameters
Name | Description |
---|---|
TResult | The type of the result. |
SelectMany(IQueryable, ParsingConfig, String, Object[])
Projects each element of a sequence to an System.Linq.IQueryable and combines the resulting sequences into one sequence.
Declaration
public static IQueryable SelectMany(this IQueryable source, ParsingConfig config, string selector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to project. |
ParsingConfig | config | The ParsingConfig. |
System.String | selector | A projection string expression to apply to each element. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable whose elements are the result of invoking a one-to-many projection function on each element of the input sequence. |
Examples
var roles = users.SelectMany("Roles");
|
Improve this Doc
View Source
SelectMany(IQueryable, ParsingConfig, String, String, Object[], Object[])
Projects each element of a sequence to an System.Linq.IQueryable 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.
Declaration
public static IQueryable SelectMany(this IQueryable source, ParsingConfig config, string collectionSelector, string resultSelector, object[] collectionSelectorArgs = null, params object[] resultSelectorArgs)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to project. |
ParsingConfig | config | The ParsingConfig. |
System.String | collectionSelector | A projection function to apply to each element of the input sequence. |
System.String | resultSelector | A projection function to apply to each element of each intermediate sequence. Should only use x and y as parameter names. |
System.Object[] | collectionSelectorArgs | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
System.Object[] | resultSelectorArgs | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable whose elements are the result of invoking the one-to-many
projection function |
Examples
// TODO
|
Improve this Doc
View Source
SelectMany(IQueryable, ParsingConfig, String, String, String, String, Object[], Object[])
Projects each element of a sequence to an System.Linq.IQueryable 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.
Declaration
public static IQueryable SelectMany(this IQueryable source, ParsingConfig config, string collectionSelector, string resultSelector, string collectionParameterName, string resultParameterName, object[] collectionSelectorArgs = null, params object[] resultSelectorArgs)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to project. |
ParsingConfig | config | The ParsingConfig. |
System.String | collectionSelector | A projection function to apply to each element of the input sequence. |
System.String | resultSelector | A projection function to apply to each element of each intermediate sequence. |
System.String | collectionParameterName | The name from collectionParameter to use. Default is x. |
System.String | resultParameterName | The name from resultParameterName to use. Default is y. |
System.Object[] | collectionSelectorArgs | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
System.Object[] | resultSelectorArgs | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable whose elements are the result of invoking the one-to-many
projection function |
Examples
// TODO
|
Improve this Doc
View Source
SelectMany(IQueryable, ParsingConfig, Type, String, Object[])
Projects each element of a sequence to an System.Linq.IQueryable and combines the resulting sequences into one sequence.
Declaration
public static IQueryable SelectMany(this IQueryable source, ParsingConfig config, Type resultType, string selector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to project. |
ParsingConfig | config | The ParsingConfig. |
System.Type | resultType | The result type. |
System.String | selector | A projection string expression to apply to each element. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable whose elements are the result of invoking a one-to-many projection function on each element of the input sequence. |
Examples
var permissions = users.SelectMany(typeof(Permission), "Roles.SelectMany(Permissions)");
|
Improve this Doc
View Source
SelectMany(IQueryable, String, Object[])
Projects each element of a sequence to an System.Linq.IQueryable and combines the resulting sequences into one sequence.
Declaration
public static IQueryable SelectMany(this IQueryable source, string selector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | selector | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable whose elements are the result of invoking a one-to-many projection function on each element of the input sequence. |
SelectMany(IQueryable, String, String, Object[], Object[])
Projects each element of a sequence to an System.Linq.IQueryable 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.
Declaration
public static IQueryable SelectMany(this IQueryable source, string collectionSelector, string resultSelector, object[] collectionSelectorArgs = null, params object[] resultSelectorArgs)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | collectionSelector | |
System.String | resultSelector | |
System.Object[] | collectionSelectorArgs | |
System.Object[] | resultSelectorArgs |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable whose elements are the result of invoking the one-to-many
projection function |
SelectMany(IQueryable, String, String, String, String, Object[], Object[])
Projects each element of a sequence to an System.Linq.IQueryable 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.
Declaration
public static IQueryable SelectMany(this IQueryable source, string collectionSelector, string resultSelector, string collectionParameterName, string resultParameterName, object[] collectionSelectorArgs = null, params object[] resultSelectorArgs)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | collectionSelector | |
System.String | resultSelector | |
System.String | collectionParameterName | |
System.String | resultParameterName | |
System.Object[] | collectionSelectorArgs | |
System.Object[] | resultSelectorArgs |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable whose elements are the result of invoking the one-to-many
projection function |
SelectMany(IQueryable, Type, String, Object[])
Projects each element of a sequence to an System.Linq.IQueryable and combines the resulting sequences into one sequence.
Declaration
public static IQueryable SelectMany(this IQueryable source, Type resultType, string selector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.Type | resultType | |
System.String | selector | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable whose elements are the result of invoking a one-to-many projection function on each element of the input sequence. |
SelectMany<TResult>(IQueryable, ParsingConfig, String, Object[])
Projects each element of a sequence to an System.Linq.IQueryable<T> and combines the resulting sequences into one sequence.
Declaration
public static IQueryable<TResult> SelectMany<TResult>(this IQueryable source, ParsingConfig config, string selector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of values to project. |
ParsingConfig | config | The ParsingConfig. |
System.String | selector | A projection string expression to apply to each element. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable<TResult> | An System.Linq.IQueryable<T> whose elements are the result of invoking a one-to-many projection function on each element of the input sequence. |
Type Parameters
Name | Description |
---|---|
TResult | The type of the result. |
Examples
var permissions = users.SelectMany<Permission>("Roles.SelectMany(Permissions)");
|
Improve this Doc
View Source
SelectMany<TResult>(IQueryable, String, Object[])
Projects each element of a sequence to an System.Linq.IQueryable<T> and combines the resulting sequences into one sequence.
Declaration
public static IQueryable<TResult> SelectMany<TResult>(this IQueryable source, string selector, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | selector | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable<TResult> | An System.Linq.IQueryable<T> whose elements are the result of invoking a one-to-many projection function on each element of the input sequence. |
Type Parameters
Name | Description |
---|---|
TResult | The type of the result. |
Single(IQueryable)
Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.
Declaration
public static object Single(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A System.Linq.IQueryable to return the single element of. |
Returns
Type | Description |
---|---|
System.Object | The single element of the input sequence. |
Single(IQueryable, ParsingConfig, String, Object[])
Returns the only element of a sequence that satisfies a specified condition, and throws an exception if there is not exactly one element in the sequence.
Declaration
public static object Single(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return the last element of. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Object | The first element in source that passes the test in predicate. |
Single(IQueryable, LambdaExpression)
Returns the only element of a sequence that satisfies a specified condition, and throws an exception if there is not exactly one element in the sequence.
Declaration
public static object Single(this IQueryable source, LambdaExpression lambda)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return the last element of. |
System.Linq.Expressions.LambdaExpression | lambda | A cached Lambda Expression. |
Returns
Type | Description |
---|---|
System.Object | The first element in source that passes the test in predicate. |
Single(IQueryable, String, Object[])
Returns the only element of a sequence that satisfies a specified condition, and throws an exception if there is not exactly one element in the sequence.
Declaration
public static object Single(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Object | The first element in source that passes the test in predicate. |
SingleOrDefault(IQueryable)
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.
Declaration
public static object SingleOrDefault(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A System.Linq.IQueryable to return the single element of. |
Returns
Type | Description |
---|---|
System.Object | The single element of the input sequence, or default if the sequence contains no elements. |
SingleOrDefault(IQueryable, ParsingConfig, String, Object[])
Returns the only element of a sequence that satisfies a specified condition or a default value if the sequence is empty; and throws an exception if there is not exactly one element in the sequence.
Declaration
public static object SingleOrDefault(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return the last element of. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Object | The first element in source that passes the test in predicate. |
SingleOrDefault(IQueryable, LambdaExpression)
Returns the only element of a sequence that satisfies a specified condition or a default value if the sequence is empty; and throws an exception if there is not exactly one element in the sequence.
Declaration
public static object SingleOrDefault(this IQueryable source, LambdaExpression lambda)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The System.Linq.IQueryable to return the last element of. |
System.Linq.Expressions.LambdaExpression | lambda | A cached Lambda Expression. |
Returns
Type | Description |
---|---|
System.Object | The first element in source that passes the test in predicate. |
SingleOrDefault(IQueryable, String, Object[])
Returns the only element of a sequence that satisfies a specified condition or a default value if the sequence is empty; and throws an exception if there is not exactly one element in the sequence.
Declaration
public static object SingleOrDefault(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Object | The first element in source that passes the test in predicate. |
Skip(IQueryable, Int32)
Bypasses a specified number of elements in a sequence and then returns the remaining elements.
Declaration
public static IQueryable Skip(this IQueryable source, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A System.Linq.IQueryable to return elements from. |
System.Int32 | count | The number of elements to skip before returning the remaining elements. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable that contains elements that occur after the specified index in the input sequence. |
SkipWhile(IQueryable, ParsingConfig, String, Object[])
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
Declaration
public static IQueryable SkipWhile(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence to check for being empty. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable that contains elements from source starting at the first element in the linear series that does not pass the test specified by predicate. |
Examples
IQueryable queryable = employees.AsQueryable();
var result1 = queryable.SkipWhile("Income > 50");
var result2 = queryable.SkipWhile("Income > @0", 50);
|
Improve this Doc
View Source
SkipWhile(IQueryable, String, Object[])
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
Declaration
public static IQueryable SkipWhile(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable that contains elements from source starting at the first element in the linear series that does not pass the test specified by predicate. |
Sum(IQueryable)
Computes the sum of a sequence of numeric values.
Declaration
[PublicAPI]
public static object Sum(this IQueryable source)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of numeric values to calculate the sum of. |
Returns
Type | Description |
---|---|
System.Object | The sum of the values in the sequence. |
Examples
IQueryable queryable = employees.AsQueryable();
var result1 = queryable.Sum();
var result2 = queryable.Select("Roles.Sum()");
|
Improve this Doc
View Source
Sum(IQueryable, ParsingConfig, String, Object[])
Computes the sum of a sequence of numeric values.
Declaration
[PublicAPI]
public static object Sum(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of numeric values to calculate the sum of. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Object | The sum of the values in the sequence. |
Examples
IQueryable queryable = employees.AsQueryable();
var result = queryable.Sum("Income");
|
Improve this Doc
View Source
Sum(IQueryable, LambdaExpression)
Computes the sum of a sequence of numeric values.
Declaration
[PublicAPI]
public static object Sum(this IQueryable source, LambdaExpression lambda)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence of numeric values to calculate the sum of. |
System.Linq.Expressions.LambdaExpression | lambda | A Lambda Expression. |
Returns
Type | Description |
---|---|
System.Object | The sum of the values in the sequence. |
Sum(IQueryable, String, Object[])
Computes the sum of a sequence of numeric values.
Declaration
[PublicAPI]
public static object Sum(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Object | The sum of the values in the sequence. |
Take(IQueryable, Int32)
Returns a specified number of contiguous elements from the start of a sequence.
Declaration
public static IQueryable Take(this IQueryable source, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | The sequence to return elements from. |
System.Int32 | count | The number of elements to return. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable that contains the specified number of elements from the start of source. |
TakeWhile(IQueryable, ParsingConfig, String, Object[])
Returns elements from a sequence as long as a specified condition is true.
Declaration
public static IQueryable TakeWhile(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A sequence to check for being empty. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | A function to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable that contains elements from the input sequence occurring before the element at which the test specified by predicate no longer passes. |
Examples
IQueryable queryable = employees.AsQueryable();
var result1 = queryable.TakeWhile("Income > 50");
var result2 = queryable.TakeWhile("Income > @0", 50);
|
Improve this Doc
View Source
TakeWhile(IQueryable, String, Object[])
Returns elements from a sequence as long as a specified condition is true.
Declaration
public static IQueryable TakeWhile(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | An System.Linq.IQueryable that contains elements from the input sequence occurring before the element at which the test specified by predicate no longer passes. |
ThenBy(IOrderedQueryable, ParsingConfig, String, IComparer, Object[])
Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.
Declaration
public static IOrderedQueryable ThenBy(this IOrderedQueryable source, ParsingConfig config, string ordering, IComparer comparer, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IOrderedQueryable | source | A sequence of values to order. |
ParsingConfig | config | The ParsingConfig. |
System.String | ordering | An expression string to indicate values to order by. |
System.Collections.IComparer | comparer | The comparer to use. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable | A System.Linq.IQueryable whose elements are sorted according to the specified |
ThenBy(IOrderedQueryable, ParsingConfig, String, Object[])
Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.
Declaration
public static IOrderedQueryable ThenBy(this IOrderedQueryable source, ParsingConfig config, string ordering, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IOrderedQueryable | source | A sequence of values to order. |
ParsingConfig | config | The ParsingConfig. |
System.String | ordering | An expression string to indicate values to order by. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable | A System.Linq.IQueryable whose elements are sorted according to the specified |
Examples
var result = queryable.OrderBy("LastName");
var resultSingle = result.OrderBy("NumberProperty");
var resultSingleDescending = result.OrderBy("NumberProperty DESC");
var resultMultiple = result.OrderBy("NumberProperty, StringProperty DESC");
|
Improve this Doc
View Source
ThenBy(IOrderedQueryable, String, IComparer, Object[])
Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.
Declaration
public static IOrderedQueryable ThenBy(this IOrderedQueryable source, string ordering, IComparer comparer, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IOrderedQueryable | source | |
System.String | ordering | |
System.Collections.IComparer | comparer | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable | A System.Linq.IQueryable whose elements are sorted according to the specified |
ThenBy(IOrderedQueryable, String, Object[])
Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.
Declaration
public static IOrderedQueryable ThenBy(this IOrderedQueryable source, string ordering, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IOrderedQueryable | source | |
System.String | ordering | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable | A System.Linq.IQueryable whose elements are sorted according to the specified |
ThenBy<TSource>(IOrderedQueryable<TSource>, ParsingConfig, String, IComparer, Object[])
Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.
Declaration
public static IOrderedQueryable<TSource> ThenBy<TSource>(this IOrderedQueryable<TSource> source, ParsingConfig config, string ordering, IComparer comparer, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IOrderedQueryable<TSource> | source | A sequence of values to order. |
ParsingConfig | config | The ParsingConfig. |
System.String | ordering | An expression string to indicate values to order by. |
System.Collections.IComparer | comparer | The comparer to use. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable<TSource> | A System.Linq.IOrderedQueryable<T> whose elements are sorted according to the specified |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
ThenBy<TSource>(IOrderedQueryable<TSource>, ParsingConfig, String, Object[])
Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.
Declaration
public static IOrderedQueryable<TSource> ThenBy<TSource>(this IOrderedQueryable<TSource> source, ParsingConfig config, string ordering, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IOrderedQueryable<TSource> | source | A sequence of values to order. |
ParsingConfig | config | The ParsingConfig. |
System.String | ordering | An expression string to indicate values to order by. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable<TSource> | A System.Linq.IOrderedQueryable<T> whose elements are sorted according to the specified |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
Examples
var result = queryable.OrderBy<User>("LastName");
var resultSingle = result.ThenBy<User>("NumberProperty");
var resultSingleDescending = result.ThenBy<User>("NumberProperty DESC");
var resultMultiple = result.ThenBy<User>("NumberProperty, StringProperty");
|
Improve this Doc
View Source
ThenBy<TSource>(IOrderedQueryable<TSource>, String, IComparer, Object[])
Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.
Declaration
public static IOrderedQueryable<TSource> ThenBy<TSource>(this IOrderedQueryable<TSource> source, string ordering, IComparer comparer, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IOrderedQueryable<TSource> | source | A sequence of values to order. |
System.String | ordering | An expression string to indicate values to order by. |
System.Collections.IComparer | comparer | The comparer to use. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable<TSource> | A System.Linq.IOrderedQueryable<T> whose elements are sorted according to the specified |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
ThenBy<TSource>(IOrderedQueryable<TSource>, String, Object[])
Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.
Declaration
public static IOrderedQueryable<TSource> ThenBy<TSource>(this IOrderedQueryable<TSource> source, string ordering, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IOrderedQueryable<TSource> | source | |
System.String | ordering | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IOrderedQueryable<TSource> | A System.Linq.IOrderedQueryable<T> whose elements are sorted according to the specified |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
Where(IQueryable, ParsingConfig, String, Object[])
Filters a sequence of values based on a predicate.
Declaration
public static IQueryable Where(this IQueryable source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A System.Linq.IQueryable to filter. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | An expression string to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable that contains elements from the input sequence that satisfy the condition specified by predicate. |
Examples
var result1 = queryable.Where("NumberProperty = 1");
var result2 = queryable.Where("NumberProperty = @0", 1);
var result3 = queryable.Where("StringProperty = null");
var result4 = queryable.Where("StringProperty = \"abc\"");
var result5 = queryable.Where("StringProperty = @0", "abc");
|
Improve this Doc
View Source
Where(IQueryable, LambdaExpression)
Filters a sequence of values based on a predicate.
Declaration
public static IQueryable Where(this IQueryable source, LambdaExpression lambda)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | A System.Linq.IQueryable to filter. |
System.Linq.Expressions.LambdaExpression | lambda | A cached Lambda Expression. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable that contains elements from the input sequence that satisfy the condition specified by LambdaExpression. |
Where(IQueryable, String, Object[])
Filters a sequence of values based on a predicate.
Declaration
public static IQueryable Where(this IQueryable source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable | A System.Linq.IQueryable that contains elements from the input sequence that satisfy the condition specified by predicate. |
Where<TSource>(IQueryable<TSource>, ParsingConfig, String, Object[])
Filters a sequence of values based on a predicate.
Declaration
public static IQueryable<TSource> Where<TSource>(this IQueryable<TSource> source, ParsingConfig config, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | A System.Linq.IQueryable<T> to filter. |
ParsingConfig | config | The ParsingConfig. |
System.String | predicate | An expression string to test each element for a condition. |
System.Object[] | args | An object array that contains zero or more objects to insert into the predicate as parameters. Similar to the way String.Format formats strings. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable<TSource> | A System.Linq.IQueryable<T> that contains elements from the input sequence that satisfy the condition specified by predicate. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |
Examples
var result1 = queryable.Where("NumberProperty = 1");
var result2 = queryable.Where("NumberProperty = @0", 1);
var result3 = queryable.Where("StringProperty = null");
var result4 = queryable.Where("StringProperty = \"abc\"");
var result5 = queryable.Where("StringProperty = @0", "abc");
|
Improve this Doc
View Source
Where<TSource>(IQueryable<TSource>, LambdaExpression)
Filters a sequence of values based on a predicate.
Declaration
public static IQueryable<TSource> Where<TSource>(this IQueryable<TSource> source, LambdaExpression lambda)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | |
System.Linq.Expressions.LambdaExpression | lambda | A cached Lambda Expression. |
Returns
Type | Description |
---|---|
System.Linq.IQueryable<TSource> | A System.Linq.IQueryable that contains elements from the input sequence that satisfy the condition specified by LambdaExpression. |
Type Parameters
Name | Description |
---|---|
TSource |
Where<TSource>(IQueryable<TSource>, String, Object[])
Filters a sequence of values based on a predicate.
Declaration
public static IQueryable<TSource> Where<TSource>(this IQueryable<TSource> source, string predicate, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.IQueryable<TSource> | source | |
System.String | predicate | |
System.Object[] | args |
Returns
Type | Description |
---|---|
System.Linq.IQueryable<TSource> | A System.Linq.IQueryable<T> that contains elements from the input sequence that satisfy the condition specified by predicate. |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of source. |