Dotnet Core EF Agregar múltiples registros

 
using (EFCoreContext db = new EFCoreContext())
{
    List<Department> deps = new List<Department>();
 
    deps.Add(new Department { Name = "Dept1", Descr = "" });
    deps.Add(new Department { Name = "Dept2", Descr = "" });
 
    db.Departments.AddRange(deps);
    db.SaveChanges();
}
 
//SQL Command
INSERT INTO [Departments] ([Descr], [Name])
VALUES (@p0, @p1);
 
SELECT [DepartmentID]
FROM [Departments]
WHERE @@ROWCOUNT = 1 AND [DepartmentID] = scope_identity();
          
INSERT INTO [Departments] ([Descr], [Name])
VALUES (@p0, @p1);
         
SELECT [DepartmentID]
FROM [Departments]
WHERE @@ROWCOUNT = 1 AND [DepartmentID] = scope_identity();
 
Crazy Cat