A comprehensive guide to bulk inserting large volumes of data with Entity Framework Core 10. Covers the three compounding failures of the naive per-row SaveChanges loop (change tracker O(n²) cost, round-trip count, memory pressure), then walks through every approach in order of complexity: AddRange+SaveChangesAsync (the correct default for most workloads), raw SqlBulkCopy (maximum speed with significant maintenance cost), and Entity Framework Extensions BulkInsert (near-SqlBulkCopy throughput with EF Core model integration). Includes detailed coverage of EFE options like BulkInsertOptimized, InsertIfNotExists, and IncludeGraph for parent-child graph inserts. Benchmark data comparing all approaches at 1K–100K order rows is provided, along with a decision guide and production gotchas around transaction hygiene, interceptor bypass, and provider differences.
Table of contents
The Three Compounding FailuresThe Correct Default: AddRange and SaveChangesGoing Lower: SqlBulkCopyEntity Framework Extensions: BulkInsertThe Graph Problem and IncludeGraphBenchmark ResultsHow to ChooseProduction Surprises Worth KnowingWhere This Leaves YouSort: