DbContext.AddRangeAsync DbContext.AddRangeAsync DbContext.AddRangeAsync Method

Definition

Overloads

AddRangeAsync(Object[]) AddRangeAsync(Object[]) AddRangeAsync(Object[])

Begins tracking the given entity, and any other reachable entities that are not already being tracked, in the Added state such that they will be inserted into the database when SaveChanges() is called.

This method is async only to allow special value generators, such as the one used by 'Microsoft.EntityFrameworkCore.Metadata.SqlServerValueGenerationStrategy.SequenceHiLo', to access the database asynchronously. For all other cases the non async method should be used.

AddRangeAsync(IEnumerable<Object>, CancellationToken) AddRangeAsync(IEnumerable<Object>, CancellationToken)

Begins tracking the given entity, and any other reachable entities that are not already being tracked, in the Added state such that they will be inserted into the database when SaveChanges() is called.

This method is async only to allow special value generators, such as the one used by 'Microsoft.EntityFrameworkCore.Metadata.SqlServerValueGenerationStrategy.SequenceHiLo', to access the database asynchronously. For all other cases the non async method should be used.

AddRangeAsync(Object[]) AddRangeAsync(Object[]) AddRangeAsync(Object[])

Begins tracking the given entity, and any other reachable entities that are not already being tracked, in the Added state such that they will be inserted into the database when SaveChanges() is called.

This method is async only to allow special value generators, such as the one used by 'Microsoft.EntityFrameworkCore.Metadata.SqlServerValueGenerationStrategy.SequenceHiLo', to access the database asynchronously. For all other cases the non async method should be used.

public virtual System.Threading.Tasks.Task AddRangeAsync (params object[] entities);
abstract member AddRangeAsync : obj[] -> System.Threading.Tasks.Task
override this.AddRangeAsync : obj[] -> System.Threading.Tasks.Task
Public Overridable Function AddRangeAsync (ParamArray entities As Object()) As Task

Parameters

entities
Object[]

The entities to add.

Returns

A task that represents the asynchronous operation.

AddRangeAsync(IEnumerable<Object>, CancellationToken) AddRangeAsync(IEnumerable<Object>, CancellationToken)

Begins tracking the given entity, and any other reachable entities that are not already being tracked, in the Added state such that they will be inserted into the database when SaveChanges() is called.

This method is async only to allow special value generators, such as the one used by 'Microsoft.EntityFrameworkCore.Metadata.SqlServerValueGenerationStrategy.SequenceHiLo', to access the database asynchronously. For all other cases the non async method should be used.

[System.Runtime.CompilerServices.AsyncStateMachine(typeof(Microsoft.EntityFrameworkCore.DbContext/<AddRangeAsync>d__83))]
[System.Runtime.CompilerServices.AsyncStateMachine(typeof(Microsoft.EntityFrameworkCore.DbContext/<AddRangeAsync>d__61))]
[System.Runtime.CompilerServices.AsyncStateMachine(typeof(Microsoft.EntityFrameworkCore.DbContext/<AddRangeAsync>d__79))]
public virtual System.Threading.Tasks.Task AddRangeAsync (System.Collections.Generic.IEnumerable<object> entities, System.Threading.CancellationToken cancellationToken = null);
abstract member AddRangeAsync : seq<obj> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.AddRangeAsync : seq<obj> * System.Threading.CancellationToken -> System.Threading.Tasks.Task

Parameters

entities
IEnumerable<Object>

The entities to add.

cancellationToken
CancellationToken CancellationToken CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

A task that represents the asynchronous operation.

Applies to