将大量实体插入SQL Server 2012 [英] Insertion large number of Entities into SQL Server 2012

查看:65
本文介绍了将大量实体插入SQL Server 2012的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个使用Entity Framework 5和SQL Server 2012的项目中。我们需要一次插入大量行(10万个实体的顺序)。基本上,我们有一个物理程序,可以输出大量的二进制数据,然后需要处理这些数据并将其提取到SQL 2012 DB中。我们在应用程序的其他位置使用EF5作为ORM,但我怀疑它是否能够及时处理这种插入。

I'm on a project using Entity Framework 5 and SQL Server 2012. We have a need to insert a large number of rows at once (order of 100k entities). Basically we have a physics program that outputs a large amount of binary data that we then need to process and pull into a SQL 2012 DB. We're using EF5 as the ORM in other places in the application, but I'm doubtful of it's ability to handle this kind of insert in a timely fashion.

'使用数据库优先方法,其中从模型生成的POCO作为主要DTO在整个代码库中传递。

We're using a database-first approach where the POCOs generated from the model are passed around throughout the code-base as the primary DTOs.

我还要补充一点,涉及具有外键关系的多个表。

I would also add that this insert involves multiple tables with foreign key relationships. Is this an issue with the various bulk insert methods out there.

有人对这种或推荐的方法有类似的经验吗?

Does anyone have any similar experience with this or a recommended approach?

推荐答案

我会研究可用的批量插入。这是一些信息的链接:批量插入。我还要看看 SQL Compact Bulk ,它在此处
用户提交其代码的另一个链接堆栈链接

I would look into the Bulk Insert that is available. Here is a link to some information on it: Bulk Insert. I would also look at SQL Compact Bulk, which was used Here . Another link where a user submitted his code Stack Link.

这篇关于将大量实体插入SQL Server 2012的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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