首页 > 数据库技术 > 详细

EF 多线程插入 Insert into DbContext Multithreading

时间:2015-08-11 09:53:19      阅读:238      评论:0      收藏:0      [点我收藏+]

当通过task 插入多条数据时报错。

DBcontext 不是线程安全的, 如果是WebAPI 为每个请求创建DbContext

部分解释:

http://stackoverflow.com/questions/28106267/insert-into-dbcontext-multithreading#

DbContext isn‘t thread-safe.

 

One context and many threads - it is a bad practice. It is best to create the context for each thread. I could recommend to you reconsider your algorithm and reate the context for each thread

EF 多线程插入 Insert into DbContext Multithreading

原文:http://www.cnblogs.com/miralce/p/4720025.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!