在实体框架核心中批量插入MySQL [英] Bulk-Insert to MySQL in Entity-Framework Core

查看:67
本文介绍了在实体框架核心中批量插入MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含约10,000个对象(例如类Person)的列表,需要将其插入到MySQL表中.如果我使用常规的DbContext.SaveChanges(),则需要60-70秒的时间发布,因此我需要大幅度减少.我发现了批量插入的几个扩展名:

不幸的是,MySQL数据库似乎不存在这种情况.有人知道MySQL吗?如果没有,谁能给我一种解决方法,使我自己制作或调整上述解决方案?谢谢!

解决方案

幸运的是,现在免费提供:

EF6.BulkInsert.MySql 6.1.0.6 durch Vitor Ortuondo

BulkInsert.EF6.MySql 6.0.4 durch Kinshines

I have a list consisting of ~10,000 objects (let's say of class Person) that I need to insert to a MySQL table. If I use the regular DbContext.SaveChanges(), it takes 60-70 seconds to issue, which I need to reduce drastically. I've found several extensions for bulk-insertions:

Unfortunately, non seem to exist for MySQL databases. Does anybody know of one for MySQL? If not, could anyone give me an approach as to how I could make my own or adjust the aforementioned solutions? Thank you!

解决方案

Fortunately it is available now for free:

EF6.BulkInsert.MySql 6.1.0.6 durch Vitor Ortuondo

BulkInsert.EF6.MySql 6.0.4 durch Kinshines

这篇关于在实体框架核心中批量插入MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆