DbContext.AddRangeAsync DbContext.AddRangeAsync Method

Definition

Overloads

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(Of 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())

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 Task AddRangeAsync(params object[] entities)
Public Overridable Function AddRangeAsync(ParamArray entities As Object()) As Task

Parameters

entities
System.Object[] System.Object()

The entities to add.

Returns

System.Threading.Tasks.Task System.Threading.Tasks.Task

A task that represents the asynchronous operation.

AddRangeAsync(IEnumerable<Object>, CancellationToken) AddRangeAsync(IEnumerable(Of 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.

public virtual Task AddRangeAsync(IEnumerable<object> entities, CancellationToken cancellationToken = null)
Public Overridable Function AddRangeAsync(entities As IEnumerable(Of Object), cancellationToken As CancellationToken = Nothing) As Task

Parameters

entities
System.Collections.Generic.IEnumerable<System.Object> System.Collections.Generic.IEnumerable(Of System.Object)

The entities to add.

cancellationToken
System.Threading.CancellationToken System.Threading.CancellationToken

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

Returns

System.Threading.Tasks.Task System.Threading.Tasks.Task

A task that represents the asynchronous operation.