Since EF Extension is not open source and owned by a company, I just show my result using its trial version and don’t want to make any troubles with that company. Maybe I made some mistakes in my coding or setting, you may using its trail version code to test by yourself.

My Device and Software Information

Processor: i7-6800k 3.4GHz

RAM: 32.0 GB, 2133MHz

Disk: SSD 850 PRO 256GB

Motherboard: 99A GAMING PRO CARBON

IDE: Microsoft Visual Studio Community 2017 Version 15.1

SQL Server: SQL Server 2016

System: Window 10

The Test Result

From this result, we can see the original EF AddRange takes the longest time to insert data, while EF Utility takes the best records, using only 3619 ms. To my surprise, the EF extension takes much longer time than the open source EF Utility. I suppose to believe EF Extension will be the best since it asks for payment using its tools.

Test Detail

You can check my code in my Github repository at https://github.com/Lukas1882/ASP.Net_Database_Insert_Speed_Test. Since the EF extension is not open source, I have deleted the all the related source file related to it. To test it in your local, please install the trial version and user the test code which in my Git Log. EF Extension is very easy to use, you won’t miss it.

Insert the Data ( C# Code )

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

+using System;

+using System.Collections.Generic;

+using System.Linq;

+using System.Text;

+using System.Threading.Tasks;

+using Newtonsoft.Json;

+using DataSpeedTest.Data.EF;

+using EntityFramework.Utilities;

+

+

+namespaceDataSpeedTest

+{

+classInsertHelper_EF

+{

+publicstaticvoidInsertFromListByRange(List list)

+{

+using(vardb=newTestEntities())

+{

+db.TargetTable1.AddRange(list);

+db.SaveChanges();

+}

+}

+

+publicstaticvoidInsertFromListByEFUtiInserAll(List list)

+{

+using(vardb=newTestEntities())

+{

+EFBatchOperation.For(db,db.TargetTable1).InsertAll(list);

+}

+}

+

+publicstaticvoidInsertFromListByExtension(List list,intbulkSize=0)

+{

+using(vardb=newTestEntities())

+{

+db.TargetTable1.AddRange(list);// add

+if(bulkSize==0)

+db.BulkSaveChanges();

+else

+db.BulkSaveChanges(bulk=>bulk.BatchSize=bulkSize);

+}

+}

+

+}

+}

Our SQL Test Data

For the data in the SQL Server, this is the SQL Script to create 2 tables, one is the source table, one is the target table.