views:

62

answers:

1

I used Linq to insert objects into database.But if i used threads to simultanously create 20 object within 1 second, then system will fail to add 20 objects into database.

And I found it is not because of the sql server 's limit. so the only possible is Linq, any one have idea ? How can I create 20 records or more in 1 second within 1 second ?

+1  A: 

You mentioned you are using threads to insert 20 records into your database. If you are using the same database context, this could be your problem. I don't believe the L2S database context object is thread safe.

Randy

Randy Minder