QueryableExtensions

Ecng.Linq

Provides extension methods for IQueryable to support asynchronous operations and dynamic ordering.

方法

AnyAsync``1
public static ValueTask<bool> AnyAsync<T>(IQueryable<T> source, CancellationToken cancellationToken)
result = QueryableExtensions.AnyAsync(source, cancellationToken)

Asynchronously determines whether a sequence contains any elements.

source
The source queryable sequence.
cancellationToken
A token to monitor for cancellation requests.

返回值: A ValueTask representing the asynchronous operation. The task result contains true if the sequence contains any elements; otherwise, false.

CountAsync``1
public static ValueTask<long> CountAsync<T>(IQueryable<T> source, CancellationToken cancellationToken)
result = QueryableExtensions.CountAsync(source, cancellationToken)

Asynchronously counts the number of elements in a sequence.

source
The source queryable sequence.
cancellationToken
A token to monitor for cancellation requests.

返回值: A ValueTask representing the asynchronous operation. The task result contains the count of elements.

FirstOrDefaultAsync``1
public static ValueTask<T> FirstOrDefaultAsync<T>(IQueryable<T> source, CancellationToken cancellationToken)
result = QueryableExtensions.FirstOrDefaultAsync(source, cancellationToken)

Asynchronously returns the first element of a sequence, or a default value if the sequence contains no elements.

source
The source queryable sequence.
cancellationToken
A token to monitor for cancellation requests.

返回值: A ValueTask representing the asynchronous operation. The task result contains the first element in the sequence or a default value if no element is found.

GetMethodInfo``1
public static MethodInfo GetMethodInfo<T1>(Action<T1> f)
result = QueryableExtensions.GetMethodInfo(f)

Retrieves the MethodInfo for the specified delegate.

f
The delegate to obtain the method information from.

返回值: The MethodInfo of the delegate.

GetMethodInfo``2
public static MethodInfo GetMethodInfo<T1, T2>(Func<T1, T2> f, T1 unused1)
result = QueryableExtensions.GetMethodInfo(f, unused1)

Retrieves the MethodInfo for the specified delegate.

f
The delegate to obtain the method information from.
unused1
A parameter used only for type inference.

返回值: The MethodInfo of the delegate.

GetMethodInfo``2
public static MethodInfo GetMethodInfo<T1, T2>(Action<T1, T2> f, T1 unused1, T2 unused2)
result = QueryableExtensions.GetMethodInfo(f, unused1, unused2)

Retrieves the MethodInfo for the specified delegate.

f
The delegate to obtain the method information from.
unused1
A parameter used only for type inference.
unused2
A parameter used only for type inference.

返回值: The MethodInfo of the delegate.

GetMethodInfo``3
public static MethodInfo GetMethodInfo<T1, T2, T3>(Action<T1, T2, T3> f, T1 unused1, T2 unused2, T3 unused3)
result = QueryableExtensions.GetMethodInfo(f, unused1, unused2, unused3)

Retrieves the MethodInfo for the specified delegate.

f
The delegate to obtain the method information from.
unused1
A parameter used only for type inference.
unused2
A parameter used only for type inference.
unused3
A parameter used only for type inference.

返回值: The MethodInfo of the delegate.

GetMethodInfo``3
public static MethodInfo GetMethodInfo<T1, T2, T3>(Func<T1, T2, T3> f, T1 unused1, T2 unused2)
result = QueryableExtensions.GetMethodInfo(f, unused1, unused2)

Retrieves the MethodInfo for the specified delegate.

f
The delegate to obtain the method information from.
unused1
A parameter used only for type inference.
unused2
A parameter used only for type inference.

返回值: The MethodInfo of the delegate.

GetMethodInfo``4
public static MethodInfo GetMethodInfo<T1, T2, T3, T4>(Action<T1, T2, T3, T4> f, T1 unused1, T2 unused2, T3 unused3, T4 unused4)
result = QueryableExtensions.GetMethodInfo(f, unused1, unused2, unused3, unused4)

Retrieves the MethodInfo for the specified delegate.

f
The delegate to obtain the method information from.
unused1
A parameter used only for type inference.
unused2
A parameter used only for type inference.
unused3
A parameter used only for type inference.
unused4
A parameter used only for type inference.

返回值: The MethodInfo of the delegate.

GetMethodInfo``4
public static MethodInfo GetMethodInfo<T1, T2, T3, T4>(Func<T1, T2, T3, T4> f, T1 unused1, T2 unused2, T3 unused3)
result = QueryableExtensions.GetMethodInfo(f, unused1, unused2, unused3)

Retrieves the MethodInfo for the specified delegate.

f
The delegate to obtain the method information from.
unused1
A parameter used only for type inference.
unused2
A parameter used only for type inference.
unused3
A parameter used only for type inference.

返回值: The MethodInfo of the delegate.

GetMethodInfo``5
public static MethodInfo GetMethodInfo<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5> f, T1 unused1, T2 unused2, T3 unused3, T4 unused4, T5 unused5)
result = QueryableExtensions.GetMethodInfo(f, unused1, unused2, unused3, unused4, unused5)

Retrieves the MethodInfo for the specified delegate.

f
The delegate to obtain the method information from.
unused1
A parameter used only for type inference.
unused2
A parameter used only for type inference.
unused3
A parameter used only for type inference.
unused4
A parameter used only for type inference.
unused5
A parameter used only for type inference.

返回值: The MethodInfo of the delegate.

GetMethodInfo``5
public static MethodInfo GetMethodInfo<T1, T2, T3, T4, T5>(Func<T1, T2, T3, T4, T5> f, T1 unused1, T2 unused2, T3 unused3, T4 unused4)
result = QueryableExtensions.GetMethodInfo(f, unused1, unused2, unused3, unused4)

Retrieves the MethodInfo for the specified delegate.

f
The delegate to obtain the method information from.
unused1
A parameter used only for type inference.
unused2
A parameter used only for type inference.
unused3
A parameter used only for type inference.
unused4
A parameter used only for type inference.

返回值: The MethodInfo of the delegate.

GetMethodInfo``6
public static MethodInfo GetMethodInfo<T1, T2, T3, T4, T5, T6>(Func<T1, T2, T3, T4, T5, T6> f, T1 unused1, T2 unused2, T3 unused3, T4 unused4, T5 unused5)
result = QueryableExtensions.GetMethodInfo(f, unused1, unused2, unused3, unused4, unused5)

Retrieves the MethodInfo for the specified delegate.

f
The delegate to obtain the method information from.
unused1
A parameter used only for type inference.
unused2
A parameter used only for type inference.
unused3
A parameter used only for type inference.
unused4
A parameter used only for type inference.
unused5
A parameter used only for type inference.

返回值: The MethodInfo of the delegate.

GetMethodInfo``6
public static MethodInfo GetMethodInfo<T1, T2, T3, T4, T5, T6>(Action<T1, T2, T3, T4, T5, T6> f, T1 unused1, T2 unused2, T3 unused3, T4 unused4, T5 unused5, T6 unused6)
result = QueryableExtensions.GetMethodInfo(f, unused1, unused2, unused3, unused4, unused5, unused6)

Retrieves the MethodInfo for the specified delegate.

f
The delegate to obtain the method information from.
unused1
A parameter used only for type inference.
unused2
A parameter used only for type inference.
unused3
A parameter used only for type inference.
unused4
A parameter used only for type inference.
unused5
A parameter used only for type inference.
unused6
A parameter used only for type inference.

返回值: The MethodInfo of the delegate.

OrderByDescending``1
public static IOrderedQueryable<T> OrderByDescending<T>(IQueryable<T> source, string propertyName, bool ignoreCase)
result = QueryableExtensions.OrderByDescending(source, propertyName, ignoreCase)

Dynamically orders the elements of a sequence in descending order based on a property name.

source
The source queryable sequence.
propertyName
The property name to order by.
ignoreCase
If set to true, ignores case during property name comparison.

返回值: An IOrderedQueryable whose elements are sorted in descending order according to the specified property.

OrderBy``1
public static IOrderedQueryable<T> OrderBy<T>(IQueryable<T> source, string propertyName, bool ignoreCase)
result = QueryableExtensions.OrderBy(source, propertyName, ignoreCase)

Dynamically orders the elements of a sequence in ascending order based on a property name.

source
The source queryable sequence.
propertyName
The property name to order by.
ignoreCase
If set to true, ignores case during property name comparison.

返回值: An IOrderedQueryable whose elements are sorted according to the specified property.

SkipLong``1
public static IQueryable<T> SkipLong<T>(IQueryable<T> source, long count)
result = QueryableExtensions.SkipLong(source, count)

Skips the specified number of elements in the source sequence.

source
The source queryable sequence.
count
The number of elements to skip.

返回值: An IQueryable that contains the elements that occur after the specified number of elements.

ThenByDescending``1
public static IOrderedQueryable<T> ThenByDescending<T>(IOrderedQueryable<T> source, string propertyName, bool ignoreCase)
result = QueryableExtensions.ThenByDescending(source, propertyName, ignoreCase)

Dynamically performs a subsequent ordering of the elements of a sequence in descending order based on a property name.

source
An ordered queryable sequence.
propertyName
The property name to order by.
ignoreCase
If set to true, ignores case during property name comparison.

返回值: An IOrderedQueryable whose elements are further sorted in descending order according to the specified property.

ThenBy``1
public static IOrderedQueryable<T> ThenBy<T>(IOrderedQueryable<T> source, string propertyName, bool ignoreCase)
result = QueryableExtensions.ThenBy(source, propertyName, ignoreCase)

Dynamically performs a subsequent ordering of the elements of a sequence in ascending order based on a property name.

source
An ordered queryable sequence.
propertyName
The property name to order by.
ignoreCase
If set to true, ignores case during property name comparison.

返回值: An IOrderedQueryable whose elements are further sorted according to the specified property.

ToArrayAsync``1
public static ValueTask<T[]> ToArrayAsync<T>(IQueryable<T> source, CancellationToken cancellationToken)
result = QueryableExtensions.ToArrayAsync(source, cancellationToken)

Asynchronously creates an array from a sequence.

source
The source queryable sequence.
cancellationToken
A token to monitor for cancellation requests.

返回值: A ValueTask representing the asynchronous operation. The task result contains an array that holds the elements from the sequence.