Using LINQ-to-Entities 4.0, is there a correct pattern or construct for safely implementing \"if not exists then insert\"?
For example, I currently have a table that tra
You could try to wrap it in a transaction combined with the 'famous' try/catch pattern:
using (var scope = new TransactionScope()) try { //...do your thing... scope.Complete(); } catch (UpdateException ex) { // here the second request ends up... }