Bulk insert to MySQL in Entity-Framework core

I have a list of ~ 10,000 objects (say a class Person

) that I need to insert into a MySQL table. If I use a regular one DbContext.SaveChanges()

, it takes 60-70 seconds, which I have to cut sharply. I found several extensions for bulk inserts:

Unfortunately there is no MySQL database. Does anyone know of one for MySQL? If not, can anyone give me an approach for how I can make my own or adjust the above solutions? Thank!

+5


source to share


2 answers


You are trying to disable traffic inside the dbContext, which you can write:



ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;

      

0


source


Fortunately, it's available for free:

EF6.BulkInsert.MySql 6.1.0.6 durch Vitor Ortuondo



BulkInsert.EF6.MySql 6.0.4 durch Kinshines

0


source







All Articles