Parallel doesnt work with Entity Framework

后端 未结 4 1596
悲&欢浪女
悲&欢浪女 2020-11-30 02:02

I have a list of IDs, and I need to run several stored procedures on each ID.

When I am using a standard foreach loop, it works OK, but when I have many records, it

4条回答
  •  广开言路
    2020-11-30 02:48

    EF is not thread safe, so you cannot use Parallel.

    Take a look at Entity Framework and Multi threading

    and this article.

提交回复
热议问题