mtanneryd / ef-bulk-operations

Bulk operations for Entity Framework 6

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BulkInsert is not thread safety

simai4 opened this issue · comments

Helloy, @mtanneryd.

If I execute many BulkInsert in one table in many threads (parrallel executing BulkInsert), I have Exception("More id values generated than we had entities. Something went wrong, try again.").

It happens because the increment of the primary key (user integer) and the number of inserted records are compared, but they may differ when the insertion is parallel.

Hi!

Thanks for your feedback. Which version are you using?

Hi,
I'm using 1.2.2 version.

Hi,
I'm also experiencing this problem at version 1.2.3

When you say "user integer", exactly what do you mean? Have you defined your own type?

Thinking about this a bit more and reading the original bug report by simai4 again, I realize that I need to replace the "select ident...." based way of matching generated primary keys with the merge-based variant. I'll try to get it fixed and tested before the weekend.

Thanks for the valuable feedback!