I have for a long time used SqlBulkCopy with Entity Framework. I have just migrated to Entity Framework Core. Before I did something like:
var itemsDT = jobs.ToDataTable<ProfileJob>();
using (var connection = new SqlConnection(_connStr))
{
connection.Open();
using (var bulkCopy = new SqlBulkCopy(connection))
{
bulkCopy.BatchSize = 1000;
bulkCopy.DestinationTableName = "dbo.JobRemoveUniquePermissionsFailed";
bulkCopy.WriteToServer(itemsDT);
}
}
The ToDataTable was a large extension class build on the old Entity Framework. I haven't found any samples on something similar with core.
Does anyone have a small sample how to use SqlBulkCopy with EF Core?