Skip to main content
.NET 8.0+

XPQueryExtensions Methods

Provides extension methods to work with XPQuery<T> objects.
Name Description
AllAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, CancellationToken) static Asynchronously checks whether all objects in a selection meet specific requirements.
AnyAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, CancellationToken) static Asynchronously checks whether any object in a selection meets specific requirements.
AnyAsync<T>(IQueryable<T>, CancellationToken) static Asynchronously checks whether any objects exist in a selection.
AverageAsync(IQueryable<Decimal>, CancellationToken) static Asynchronously calculates an average of objects’ specific Int64 fields for a query.
AverageAsync(IQueryable<Double>, CancellationToken) static Asynchronously calculates an average of objects’ specific Double fields for a query.
AverageAsync(IQueryable<Int32>, CancellationToken) static Asynchronously calculates an average of objects’ specific Int32 fields, for a query.
AverageAsync(IQueryable<Int64>, CancellationToken) static Asynchronously calculates an average of objects’ specific Int64 fields for a query.
AverageAsync(IQueryable<Single>, CancellationToken) static Asynchronously calculates an average of objects’ specific Single fields for a query.
AverageAsync<T>(IQueryable<T>, Expression<Func<T, Decimal>>, CancellationToken) static Asynchronously calculates an average of objects’ specific Decimal fields for a query. Uses a lambda expression to obtain values.
AverageAsync<T>(IQueryable<T>, Expression<Func<T, Double>>, CancellationToken) static Asynchronously calculates an average of objects’ specific Double fields for a query. Uses a lambda expression to obtain values.
AverageAsync<T>(IQueryable<T>, Expression<Func<T, Int32>>, CancellationToken) static Asynchronously calculates an average of objects’ specific Int32 fields for a query. Uses a lambda expression to obtain values.
AverageAsync<T>(IQueryable<T>, Expression<Func<T, Int64>>, CancellationToken) static Asynchronously calculates an average of objects’ specific Int64 fields for a query. Uses a lambda expression to obtain values.
AverageAsync<T>(IQueryable<T>, Expression<Func<T, Single>>, CancellationToken) static Asynchronously calculates an average of objects’ specific Decimal fields for a query. Uses a lambda expression to obtain values.
CachedExpression<TSource, TResult>(IQueryable<TSource>, Func<IQueryable<TSource>, TResult>) static For internal use.
CachedExpression<TSource, TArg1, TResult>(IQueryable<TSource>, Func<IQueryable<TSource>, TArg1, TResult>, TArg1) static For internal use.
CachedExpression<TSource, TArg1, TArg2, TResult>(IQueryable<TSource>, Func<IQueryable<TSource>, TArg1, TArg2, TResult>, TArg1, TArg2) static For internal use.
CachedExpression<TSource, TArg1, TArg2, TArg3, TResult>(IQueryable<TSource>, Func<IQueryable<TSource>, TArg1, TArg2, TArg3, TResult>, TArg1, TArg2, TArg3) static For internal use.
CachedExpression<TSource, TArg1, TArg2, TArg3, TArg4, TResult>(IQueryable<TSource>, Func<IQueryable<TSource>, TArg1, TArg2, TArg3, TArg4, TResult>, TArg1, TArg2, TArg3, TArg4) static For internal use.
CachedExpression<TSource, TArg1, TArg2, TArg3, TArg4, TArg5, TResult>(IQueryable<TSource>, Func<IQueryable<TSource>, TArg1, TArg2, TArg3, TArg4, TArg5, TResult>, TArg1, TArg2, TArg3, TArg4, TArg5) static For internal use.
ContainsAsync<T>(IQueryable<T>, T, CancellationToken) static Asynchronously checks whether a specific object exists in a selection.
CountAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, CancellationToken) static Asynchronously counts the number of objects that meet specific requirements in a specified selection.
CountAsync<T>(IQueryable<T>, CancellationToken) static Asynchronously counts the number of objects in a selection.
CustomAggregate<T>(IQueryable<T>, String, Expression<Func<T, Object>>[]) static
CustomAggregateAsync<T>(IQueryable<T>, String, Expression<Func<T, Object>>, CancellationToken) static
CustomAggregateAsync<T>(IQueryable<T>, String, Expression<Func<T, Object>>[], CancellationToken) static
CustomAggregateAsync<T>(IQueryable<T>, String, Expression<Func<T, Object>>[]) static
ElementAtAsync<T>(IQueryable<T>, Int32, CancellationToken) static Asynchronously gets an object that has a specific index in a selection.
ElementAtOrDefaultAsync<T>(IQueryable<T>, Int32, CancellationToken) static Asynchronously gets an object that has a specific index in a selection. If the index is not valid, returns a default value for <T>.
EnumerateAsync<T>(IQueryable<T>, XPQueryExtensions.AsyncEnumerateCallback) static Asynchronously enumerates a specified query and notifies upon completion.
EnumerateAsync<T>(IQueryable<T>, XPQueryExtensions.AsyncEnumerateCallback<T>) static Asynchronously enumerates a specified query and notifies upon completion.
EnumerateAsync<T>(IQueryable<T>, CancellationToken) static Asynchronously enumerates a specified query.
Equals(Object, Object) static Determines whether the specified object instances are considered equal. Inherited from Object.
Equals(Object) Determines whether the specified object is equal to the current object. Inherited from Object.
FirstAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, CancellationToken) static Asynchronously gets the first object that meets specified requirements in a selection. Throws an exception for empty selections.
FirstAsync<T>(IQueryable<T>, CancellationToken) static Asynchronously gets the first object in a selection. Throws an exception for empty selections.
FirstOrDefaultAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, CancellationToken) static Asynchronously gets the first object that meets specified requirements in a selection. If the selection is empty, returns a default value for <T>.
FirstOrDefaultAsync<T>(IQueryable<T>, CancellationToken) static Asynchronously gets the first object in a selection. If the selection is empty, returns a default value for <T>.
GetHashCode() Serves as the default hash function. Inherited from Object.
GetType() Gets the Type of the current instance. Inherited from Object.
LastAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, CancellationToken) static Asynchronously gets the last object that meets specified requirements in a selection. Throws an exception for empty selections.
LastAsync<T>(IQueryable<T>, CancellationToken) static Asynchronously gets the last object in a selection. Throws an exception for empty selections.
LastOrDefaultAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, CancellationToken) static Asynchronously gets the last object that meets specified requirements in a selection. If the selection is empty, returns a default value for <T>.
LastOrDefaultAsync<T>(IQueryable<T>, CancellationToken) static Asynchronously gets the last object in a selection. If the selection is empty, returns a default value for <T>.
LongCountAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, CancellationToken) static Asynchronously counts the number of objects that meet specific requirements in a specified selection.
LongCountAsync<T>(IQueryable<T>, CancellationToken) static Asynchronously counts the number of objects in a selection.
MaxAsync<T>(IQueryable<T>, CancellationToken) static Asynchronously gets the maximum value from a specified query.
MaxAsync<T, TResult>(IQueryable<T>, Expression<Func<T, TResult>>, CancellationToken) static Asynchronously gets the maximum value from a specified query. Uses a lambda expression to obtain values.
MemberwiseClone() protected Creates a shallow copy of the current Object. Inherited from Object.
MinAsync<T>(IQueryable<T>, CancellationToken) static Asynchronously gets the minimum value from a specified query.
MinAsync<T, TResult>(IQueryable<T>, Expression<Func<T, TResult>>, CancellationToken) static Asynchronously gets the minimum value from a specified query. Uses a lambda expression to obtain values.
Query<T>(IDataLayer) static Creates a new XPQuery<T> instance from a specified session’s scope.
Query<T>(Session) static Creates a new XPQuery<T> instance from a specified session’s scope.
QueryInTransaction<T>(Session) static Creates a new XPQuery<T> instance with the InTransaction (XPQuery<T>.InTransaction) mode enabled, from a specified session’s scope.
ReferenceEquals(Object, Object) static Determines whether the specified Object instances are the same instance. Inherited from Object.
SingleAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, CancellationToken) static Asynchronously gets the object from a selection if only one object in the selection meets the specified requirements. Otherwise, throws an exception.
SingleAsync<T>(IQueryable<T>, CancellationToken) static Asynchronously gets the object from a selection if this selection has only one object. Otherwise, throws an exception.
SingleOrDefaultAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, CancellationToken) static

Asynchronously gets the object from a selection if only one object in the selection meets the specified requirements. If the selection is empty, returns a default value for <T>. If the selection has more than one of such elements, throws an exception.

SingleOrDefaultAsync<T>(IQueryable<T>, CancellationToken) static Asynchronously gets the only object in a selection. If the selection is empty, returns a default value for <T>. If the selection has more than one element, throws an exception.
SumAsync(IQueryable<Decimal>, CancellationToken) static Asynchronously calculates a sum of objects’ specific Decimal fields for a query.
SumAsync(IQueryable<Double>, CancellationToken) static Asynchronously calculates a sum of objects’ specific Double fields for a query.
SumAsync(IQueryable<Int32>, CancellationToken) static Asynchronously calculates a sum of objects’ specific Int32 fields for a query.
SumAsync(IQueryable<Int64>, CancellationToken) static Asynchronously calculates a sum of objects’ specific Int64 fields for a query.
SumAsync(IQueryable<Nullable<Decimal>>, CancellationToken) static Asynchronously calculates a sum of objects’ specific nullable Decimal fields for a query.
SumAsync(IQueryable<Nullable<Double>>, CancellationToken) static Asynchronously calculates a sum of objects’ specific nullable Double fields for a query.
SumAsync(IQueryable<Nullable<Int32>>, CancellationToken) static Asynchronously calculates a sum of objects’ specific nullable Int32 fields for a query.
SumAsync(IQueryable<Nullable<Int64>>, CancellationToken) static Asynchronously calculates a sum of objects’ specific nullable Int64 fields for a query.
SumAsync(IQueryable<Nullable<Single>>, CancellationToken) static Asynchronously calculates a sum of objects’ specific nullable Single fields for a query.
SumAsync(IQueryable<Single>, CancellationToken) static Asynchronously calculates a sum of objects’ specific Single fields for a query.
SumAsync<T>(IQueryable<T>, Expression<Func<T, Decimal>>, CancellationToken) static Asynchronously calculates a sum of objects’ specific Int64 fields for a query. Uses a lambda expression to obtain values.
SumAsync<T>(IQueryable<T>, Expression<Func<T, Double>>, CancellationToken) static Asynchronously calculates a sum of objects’ specific Double fields for a query. Uses a lambda expression to obtain values.
SumAsync<T>(IQueryable<T>, Expression<Func<T, Int32>>, CancellationToken) static Asynchronously calculates a sum of objects’ specific Int32 fields for a query. Uses a lambda expression to obtain values.
SumAsync<T>(IQueryable<T>, Expression<Func<T, Int64>>, CancellationToken) static Asynchronously calculates a sum of objects’ specific Int64 fields, for a query. Uses a lambda expression to obtain values.
SumAsync<T>(IQueryable<T>, Expression<Func<T, Nullable<Decimal>>>, CancellationToken) static Asynchronously calculates a sum of objects’ specific nullable Decimal fields for a query. Uses a lambda expression to obtain values.
SumAsync<T>(IQueryable<T>, Expression<Func<T, Nullable<Double>>>, CancellationToken) static Asynchronously calculates a sum of objects’ specific nullable Double fields for a query. Uses a lambda expression to obtain values.
SumAsync<T>(IQueryable<T>, Expression<Func<T, Nullable<Int32>>>, CancellationToken) static Asynchronously calculates a sum of objects’ specific nullable Int32 fields for a query. Uses a lambda expression to obtain values.
SumAsync<T>(IQueryable<T>, Expression<Func<T, Nullable<Int64>>>, CancellationToken) static Asynchronously calculates a sum of objects’ specific nullable Int64 fields for a query. Uses a lambda expression to obtain values.
SumAsync<T>(IQueryable<T>, Expression<Func<T, Nullable<Single>>>, CancellationToken) static Asynchronously calculates a sum of objects’ specific nullable Single fields for a query. Uses a lambda expression to obtain values.
SumAsync<T>(IQueryable<T>, Expression<Func<T, Single>>, CancellationToken) static Asynchronously calculates a sum of objects’ specific Decimal fields for a query. Uses a lambda expression to obtain values.
ToArrayAsync<T>(IQueryable<T>, CancellationToken) static Asynchronously enumerates all objects in a query and saves them to an array.
ToDictionaryAsync<T, TKey>(IQueryable<T>, Func<T, TKey>, IEqualityComparer<TKey>, CancellationToken) static Asynchronously enumerates a query and uses a key selector and an element selector to construct a Dictionary<TKey,TValue>.
ToDictionaryAsync<T, TKey>(IQueryable<T>, Func<T, TKey>, CancellationToken) static Asynchronously enumerates a query and uses a key selector to construct a Dictionary<TKey,TValue>.
ToDictionaryAsync<T, TKey, TElement>(IQueryable<T>, Func<T, TKey>, Func<T, TElement>, IEqualityComparer<TKey>, CancellationToken) static Asynchronously enumerates a query and uses a key selector, an element selector, and a comparer to construct a Dictionary<TKey,TValue>.
ToDictionaryAsync<T, TKey, TElement>(IQueryable<T>, Func<T, TKey>, Func<T, TElement>, CancellationToken) static Asynchronously enumerates a query and uses a key selector and an element selector to construct a Dictionary<TKey,TValue>.
ToListAsync<T>(IQueryable<T>, CancellationToken) static Asynchronously enumerates all elements in a query and saves them to a list.
ToLookupAsync<T, TKey>(IQueryable<T>, Func<T, TKey>, IEqualityComparer<TKey>, CancellationToken) static Asynchronously enumerates a query and uses a key selector and a comparer to construct a Lookup<TKey,TElement>.
ToLookupAsync<T, TKey>(IQueryable<T>, Func<T, TKey>, CancellationToken) static Asynchronously enumerates a query and uses a key selector to construct a Lookup<TKey,TElement>.
ToLookupAsync<T, TKey, TElement>(IQueryable<T>, Func<T, TKey>, Func<T, TElement>, IEqualityComparer<TKey>, CancellationToken) static Asynchronously enumerates a query and uses a key selector, an element selector and an comparer to construct a Lookup<TKey,TElement>.
ToLookupAsync<T, TKey, TElement>(IQueryable<T>, Func<T, TKey>, Func<T, TElement>, CancellationToken) static Asynchronously enumerates a query and uses a key selector and an element selector to construct a Lookup<TKey,TElement>.
ToString() Returns a string that represents the current object. Inherited from Object.
See Also