EntityFrameworkQueryableExtensions.SumAsync 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
SumAsync(IQueryable<Nullable<Single>>, CancellationToken) |
Asynchronously computes the sum of a sequence of values. |
SumAsync(IQueryable<Nullable<Int64>>, CancellationToken) |
Asynchronously computes the sum of a sequence of values. |
SumAsync(IQueryable<Nullable<Int32>>, CancellationToken) |
Asynchronously computes the sum of a sequence of values. |
SumAsync(IQueryable<Nullable<Double>>, CancellationToken) |
Asynchronously computes the sum of a sequence of values. |
SumAsync(IQueryable<Single>, CancellationToken) |
Asynchronously computes the sum of a sequence of values. |
SumAsync(IQueryable<Int64>, CancellationToken) |
Asynchronously computes the sum of a sequence of values. |
SumAsync(IQueryable<Int32>, CancellationToken) |
Asynchronously computes the sum of a sequence of values. |
SumAsync(IQueryable<Double>, CancellationToken) |
Asynchronously computes the sum of a sequence of values. |
SumAsync(IQueryable<Decimal>, CancellationToken) |
Asynchronously computes the sum of a sequence of values. |
SumAsync(IQueryable<Nullable<Decimal>>, CancellationToken) |
Asynchronously computes the sum of a sequence of values. |
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Single>>, CancellationToken) |
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence. |
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Int64>>>, CancellationToken) |
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence. |
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Int32>>>, CancellationToken) |
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence. |
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Double>>>, CancellationToken) |
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence. |
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Single>>>, CancellationToken) |
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence. |
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int64>>, CancellationToken) |
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence. |
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32>>, CancellationToken) |
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence. |
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Double>>, CancellationToken) |
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence. |
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Decimal>>, CancellationToken) |
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence. |
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Decimal>>>, CancellationToken) |
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence. |
SumAsync(IQueryable<Nullable<Single>>, CancellationToken)
Asynchronously computes the sum of a sequence of values.
public static System.Threading.Tasks.Task<float?> SumAsync (this System.Linq.IQueryable<float?> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<Nullable<single>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Nullable<single>>
<Extension()>
Public Function SumAsync (source As IQueryable(Of Nullable(Of Single)), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Nullable(Of Single))
Parameters
- source
- IQueryable<Nullable<Single>>
A sequence of values to calculate the sum 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 sum of the values in the sequence.
Exceptions
source
is null
.
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
SumAsync(IQueryable<Nullable<Int64>>, CancellationToken)
Asynchronously computes the sum of a sequence of values.
public static System.Threading.Tasks.Task<long?> SumAsync (this System.Linq.IQueryable<long?> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<Nullable<int64>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Nullable<int64>>
<Extension()>
Public Function SumAsync (source As IQueryable(Of Nullable(Of Long)), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Nullable(Of Long))
Parameters
- source
- IQueryable<Nullable<Int64>>
A sequence of values to calculate the sum 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 sum of the values in the sequence.
Exceptions
source
is null
.
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
SumAsync(IQueryable<Nullable<Int32>>, CancellationToken)
Asynchronously computes the sum of a sequence of values.
public static System.Threading.Tasks.Task<int?> SumAsync (this System.Linq.IQueryable<int?> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<Nullable<int>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Nullable<int>>
<Extension()>
Public Function SumAsync (source As IQueryable(Of Nullable(Of Integer)), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Nullable(Of Integer))
Parameters
- source
- IQueryable<Nullable<Int32>>
A sequence of values to calculate the sum 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 sum of the values in the sequence.
Exceptions
source
is null
.
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
SumAsync(IQueryable<Nullable<Double>>, CancellationToken)
Asynchronously computes the sum of a sequence of values.
public static System.Threading.Tasks.Task<double?> SumAsync (this System.Linq.IQueryable<double?> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<Nullable<double>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Nullable<double>>
<Extension()>
Public Function SumAsync (source As IQueryable(Of Nullable(Of Double)), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Nullable(Of Double))
Parameters
- source
- IQueryable<Nullable<Double>>
A sequence of values to calculate the sum 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 sum of the values in the sequence.
Exceptions
source
is null
.
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
SumAsync(IQueryable<Single>, CancellationToken)
Asynchronously computes the sum of a sequence of values.
public static System.Threading.Tasks.Task<float> SumAsync (this System.Linq.IQueryable<float> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<single> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<single>
<Extension()>
Public Function SumAsync (source As IQueryable(Of Single), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Single)
Parameters
- source
- IQueryable<Single>
A sequence of values to calculate the sum 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 sum of the values in the sequence.
Exceptions
source
is null
.
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
SumAsync(IQueryable<Int64>, CancellationToken)
Asynchronously computes the sum of a sequence of values.
public static System.Threading.Tasks.Task<long> SumAsync (this System.Linq.IQueryable<long> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<int64> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<int64>
<Extension()>
Public Function SumAsync (source As IQueryable(Of Long), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Long)
Parameters
- source
- IQueryable<Int64>
A sequence of values to calculate the sum 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 sum of the values in the sequence.
Exceptions
source
is null
.
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
SumAsync(IQueryable<Int32>, CancellationToken)
Asynchronously computes the sum of a sequence of values.
public static System.Threading.Tasks.Task<int> SumAsync (this System.Linq.IQueryable<int> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<int> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<int>
<Extension()>
Public Function SumAsync (source As IQueryable(Of Integer), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Integer)
Parameters
- source
- IQueryable<Int32>
A sequence of values to calculate the sum 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 sum of the values in the sequence.
Exceptions
source
is null
.
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
SumAsync(IQueryable<Double>, CancellationToken)
Asynchronously computes the sum of a sequence of values.
public static System.Threading.Tasks.Task<double> SumAsync (this System.Linq.IQueryable<double> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<double> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<double>
<Extension()>
Public Function SumAsync (source As IQueryable(Of Double), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Double)
Parameters
- source
- IQueryable<Double>
A sequence of values to calculate the sum 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 sum of the values in the sequence.
Exceptions
source
is null
.
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
SumAsync(IQueryable<Decimal>, CancellationToken)
Asynchronously computes the sum of a sequence of values.
public static System.Threading.Tasks.Task<decimal> SumAsync (this System.Linq.IQueryable<decimal> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<decimal> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<decimal>
<Extension()>
Public Function SumAsync (source As IQueryable(Of Decimal), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Decimal)
Parameters
- source
- IQueryable<Decimal>
A sequence of values to calculate the sum 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 sum of the values in the sequence.
Exceptions
source
is null
.
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
SumAsync(IQueryable<Nullable<Decimal>>, CancellationToken)
Asynchronously computes the sum of a sequence of values.
public static System.Threading.Tasks.Task<decimal?> SumAsync (this System.Linq.IQueryable<decimal?> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<Nullable<decimal>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Nullable<decimal>>
<Extension()>
Public Function SumAsync (source As IQueryable(Of Nullable(Of Decimal)), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Nullable(Of Decimal))
Parameters
- source
- IQueryable<Nullable<Decimal>>
A sequence of values to calculate the sum 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 sum of the values in the sequence.
Exceptions
source
is null
.
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
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Single>>, CancellationToken)
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence.
public static System.Threading.Tasks.Task<float> SumAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,float>> selector, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, single>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<single>
<Extension()>
Public Function SumAsync(Of TSource) (source As IQueryable(Of TSource), selector As Expression(Of Func(Of TSource, Single)), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Single)
Type Parameters
- TSource
Parameters
- source
- IQueryable<TSource>
A sequence of values of type TSource
.
- selector
- Expression<Func<TSource,Single>>
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 sum of the projected values..
Exceptions
source
or selector
is null
.
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
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Int64>>>, CancellationToken)
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence.
public static System.Threading.Tasks.Task<long?> SumAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,long?>> selector, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, Nullable<int64>>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Nullable<int64>>
<Extension()>
Public Function SumAsync(Of TSource) (source As IQueryable(Of TSource), selector As Expression(Of Func(Of TSource, Nullable(Of Long))), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Nullable(Of Long))
Type Parameters
- TSource
Parameters
- source
- IQueryable<TSource>
A sequence of values of type TSource
.
- selector
- Expression<Func<TSource,Nullable<Int64>>>
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 sum of the projected values..
Exceptions
source
or selector
is null
.
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
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Int32>>>, CancellationToken)
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence.
public static System.Threading.Tasks.Task<int?> SumAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,int?>> selector, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, Nullable<int>>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Nullable<int>>
<Extension()>
Public Function SumAsync(Of TSource) (source As IQueryable(Of TSource), selector As Expression(Of Func(Of TSource, Nullable(Of Integer))), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Nullable(Of Integer))
Type Parameters
- TSource
Parameters
- source
- IQueryable<TSource>
A sequence of values of type TSource
.
- selector
- Expression<Func<TSource,Nullable<Int32>>>
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 sum of the projected values..
Exceptions
source
or selector
is null
.
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
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Double>>>, CancellationToken)
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence.
public static System.Threading.Tasks.Task<double?> SumAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,double?>> selector, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, Nullable<double>>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Nullable<double>>
<Extension()>
Public Function SumAsync(Of TSource) (source As IQueryable(Of TSource), selector As Expression(Of Func(Of TSource, Nullable(Of Double))), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Nullable(Of Double))
Type Parameters
- TSource
Parameters
- source
- IQueryable<TSource>
A sequence of values of type TSource
.
- selector
- Expression<Func<TSource,Nullable<Double>>>
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 sum of the projected values..
Exceptions
source
or selector
is null
.
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
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Single>>>, CancellationToken)
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence.
public static System.Threading.Tasks.Task<float?> SumAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,float?>> selector, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, Nullable<single>>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Nullable<single>>
<Extension()>
Public Function SumAsync(Of TSource) (source As IQueryable(Of TSource), selector As Expression(Of Func(Of TSource, Nullable(Of Single))), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Nullable(Of Single))
Type Parameters
- TSource
Parameters
- source
- IQueryable<TSource>
A sequence of values of type TSource
.
- selector
- Expression<Func<TSource,Nullable<Single>>>
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 sum of the projected values..
Exceptions
source
or selector
is null
.
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
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int64>>, CancellationToken)
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence.
public static System.Threading.Tasks.Task<long> SumAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,long>> selector, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, int64>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<int64>
<Extension()>
Public Function SumAsync(Of TSource) (source As IQueryable(Of TSource), selector As Expression(Of Func(Of TSource, Long)), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Long)
Type Parameters
- TSource
Parameters
- source
- IQueryable<TSource>
A sequence of values of type TSource
.
- selector
- Expression<Func<TSource,Int64>>
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 sum of the projected values..
Exceptions
source
or selector
is null
.
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
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Int32>>, CancellationToken)
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence.
public static System.Threading.Tasks.Task<int> SumAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,int>> selector, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, int>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<int>
<Extension()>
Public Function SumAsync(Of TSource) (source As IQueryable(Of TSource), selector As Expression(Of Func(Of TSource, Integer)), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Integer)
Type Parameters
- TSource
Parameters
- source
- IQueryable<TSource>
A sequence of values of type TSource
.
- selector
- Expression<Func<TSource,Int32>>
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 sum of the projected values..
Exceptions
source
or selector
is null
.
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
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Double>>, CancellationToken)
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence.
public static System.Threading.Tasks.Task<double> SumAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,double>> selector, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, double>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<double>
<Extension()>
Public Function SumAsync(Of TSource) (source As IQueryable(Of TSource), selector As Expression(Of Func(Of TSource, Double)), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Double)
Type Parameters
- TSource
Parameters
- source
- IQueryable<TSource>
A sequence of values of type TSource
.
- selector
- Expression<Func<TSource,Double>>
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 sum of the projected values..
Exceptions
source
or selector
is null
.
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
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Decimal>>, CancellationToken)
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence.
public static System.Threading.Tasks.Task<decimal> SumAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,decimal>> selector, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, decimal>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<decimal>
<Extension()>
Public Function SumAsync(Of TSource) (source As IQueryable(Of TSource), selector As Expression(Of Func(Of TSource, Decimal)), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Decimal)
Type Parameters
- TSource
Parameters
- source
- IQueryable<TSource>
A sequence of values of type TSource
.
- selector
- Expression<Func<TSource,Decimal>>
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 sum of the projected values..
Exceptions
source
or selector
is null
.
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
SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource,Nullable<Decimal>>>, CancellationToken)
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input sequence.
public static System.Threading.Tasks.Task<decimal?> SumAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,decimal?>> selector, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, Nullable<decimal>>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Nullable<decimal>>
<Extension()>
Public Function SumAsync(Of TSource) (source As IQueryable(Of TSource), selector As Expression(Of Func(Of TSource, Nullable(Of Decimal))), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Nullable(Of Decimal))
Type Parameters
- TSource
Parameters
- source
- IQueryable<TSource>
A sequence of values of type TSource
.
- selector
- Expression<Func<TSource,Nullable<Decimal>>>
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 sum of the projected values..
Exceptions
source
or selector
is null
.
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
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for