EntityFrameworkQueryableExtensions.MinAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
MinAsync<TSource,TResult>(IQueryable<TSource>, Expression<Func<TSource,TResult>>, CancellationToken) |
Asynchronously invokes a projection function on each element of a sequence and returns the minimum resulting value. |
MinAsync<TSource>(IQueryable<TSource>, CancellationToken) |
Asynchronously returns the minimum value of a sequence. |
MinAsync<TSource,TResult>(IQueryable<TSource>, Expression<Func<TSource,TResult>>, CancellationToken)
Asynchronously invokes a projection function on each element of a sequence and returns the minimum resulting value.
public static System.Threading.Tasks.Task<TResult> MinAsync<TSource,TResult> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,TResult>> selector, System.Threading.CancellationToken cancellationToken = default);
static member MinAsync : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Result>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>
<Extension()>
Public Function MinAsync(Of TSource, TResult) (source As IQueryable(Of TSource), selector As Expression(Of Func(Of TSource, TResult)), Optional cancellationToken As CancellationToken = Nothing) As Task(Of TResult)
Type Parameters
- TSource
The type of the elements of source
.
- TResult
The type of the value returned by the function represented by selector
.
Parameters
- source
- IQueryable<TSource>
An IQueryable<T> that contains the elements to determine the minimum of.
- selector
- Expression<Func<TSource,TResult>>
A projection function to apply to each element.
- cancellationToken
- CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Returns
A task that represents the asynchronous operation. The task result contains the minimum value in the sequence.
Exceptions
source
or selector
is null
.
source
contains no elements.
If the CancellationToken is canceled.
Remarks
Multiple active operations on the same context instance are not supported. Use await
to ensure that any asynchronous operations have completed before calling another method on this context. See Avoiding DbContext threading issues for more information and examples.
See Querying data with EF Core for more information and examples.
Applies to
MinAsync<TSource>(IQueryable<TSource>, CancellationToken)
Asynchronously returns the minimum value of a sequence.
public static System.Threading.Tasks.Task<TSource> MinAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Threading.CancellationToken cancellationToken = default);
static member MinAsync : System.Linq.IQueryable<'Source> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Source>
<Extension()>
Public Function MinAsync(Of TSource) (source As IQueryable(Of TSource), Optional cancellationToken As CancellationToken = Nothing) As Task(Of TSource)
Type Parameters
- TSource
The type of the elements of source
.
Parameters
- source
- IQueryable<TSource>
An IQueryable<T> that contains the elements to determine the minimum of.
- cancellationToken
- CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Returns
A task that represents the asynchronous operation. The task result contains the minimum value in the sequence.
Exceptions
source
is null
.
source
contains no elements.
If the CancellationToken is canceled.
Remarks
Multiple active operations on the same context instance are not supported. Use await
to ensure that any asynchronous operations have completed before calling another method on this context. See Avoiding DbContext threading issues for more information and examples.
See Querying data with EF Core for more information and examples.
Applies to
Entity Framework