Sébastien Rigaux

EF Core: choosing a strategy for bulk inserts

View resource

woodruff.dev

The right way to insert large volumes with EF Core depends on factors such as change tracking, whether generated IDs are needed, and the shape of the data. Chris Woody Woodruff compares AddRange with SaveChanges, SqlBulkCopy, and Entity Framework Extensions’ bulk operations, detailing their maintenance and behavioral trade-offs.

For parent-child relationships, IncludeGraph automates insert ordering and foreign-key assignment. The article also flags two effects to audit before adopting bulk operations: they can run outside SaveChanges’ deferred-commit flow, and ISaveChangesInterceptor implementations are not invoked.

Dark graphic titled “EF Core Bulk Insert,” with a grid of blue rows and arrows illustrating bulk data insertion.