Unexpected behaviour with Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ForEachAsync<T>()
问题 Here are the steps to reproduce. The below program copies 10,000 rows from one SQL table to another using .Net Core console app and EF Core. The program inserts records in 100 batches, and (this is important!) it creates a new instance of DbContext for each insert. 1) Create SQL Server database, and the "Froms" and "Tos" tables: create table Froms ( Id int identity(1, 1) not null, Guid [uniqueidentifier] not null, constraint [PK_Froms] primary key clustered (Id asc) ) go create table Tos ( Id