I am trying to create a transaction like so:\[code\]using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)){ try { dbContext.MyTable.PartnerId = someGuid; dbContext.SaveChanges(); scope.Complete(); dbContext.AcceptAllChanges() } catch (Exception ex) { log.LogMessageToFile("Exception - ExceptionType: " + ex.GetType().ToString() + "Exception Messsage: " + ex.Message); }}\[/code\]I know if I try to insert an item manully in sql with a duplicate in a specific column, I get the following error from sql:\[quote\] Cannot insert duplicate key row in object 'dbo.MyTable' with unique index 'idx_PartnerId_notnull'. The duplicate key value is (7b072640-ca81-4513-a425-02bb3394dfad).\[/quote\]How can I programatically catch this exception specifically, so I can act upon it.This is the constraint I put on my column:\[code\]CREATE UNIQUE NONCLUSTERED INDEX idx_yourcolumn_notnullON YourTable(yourcolumn)WHERE yourcolumn IS NOT NULL;\[/code\]