Method IsUniqueViolation(Exception)
A unique index or constraint rejected the row: PostgreSQL 23505, SQL Server 2601 (unique
index) or 2627 (unique constraint), SQLite extended code 2067 (SQLITE_CONSTRAINT_UNIQUE).
public static bool IsUniqueViolation(Exception ex)