By design I'm expecting a DuplicateKeyExeception from time to time. Is it possible to recover from such situation without recreating the Datacontext?
Ideally I would like to remove all records that have duplicated key.
By design I'm expecting a DuplicateKeyExeception from time to time. Is it possible to recover from such situation without recreating the Datacontext?
Ideally I would like to remove all records that have duplicated key.
This looks good for update conflicts. But you have insert conflicts...
Customer customer = new Customer(){Name="Bob"}
myDC.Customers.InsertOnSubmit(customer);
try
{
SubmitChanges();
}
catch(DuplicateKeyException)
{
//throw away my old Bob and get me the database's version.
myDC.Refresh(RefreshMode.OverwriteCurrentValues, customer);
}