I am working on an application that immediately adds a large amount of data to an SQL database. I am using LINQ to SQL and have something similar as my insert operation:
foreach (var obj in objects) {context.InsertOnSubmit (OBJ); } context.SubmitChanges ();
Here's the problem: if I get an exception (like DuplicateKeyException), I don't have CLUE which object caused the problem. The only information I get is that at least one of the objects contains key values ββthat are identical to any other key in the database.
Is it possible to get additional information about which objects caused the conflict?
Of course, I could call SubmitChanges after each InsertOnSubmit, but with the amount of data I insert, it is incredibly slow.
Anyone have any tips? Thanks!
source share