C# Class SqlFu.ExceptionHelpers

Show file Open project: sapiens/SqlFu

Public Methods

Method Description
IsUniqueViolation ( this db, DbException ex, string keyName = null ) : bool

Checks is the exception was thrown because an unique constraint was violated. Can be used to implement idempotency e.g you can treat primary key violations as duplicate operations

Method Details

IsUniqueViolation() public static method

Checks is the exception was thrown because an unique constraint was violated. Can be used to implement idempotency e.g you can treat primary key violations as duplicate operations
public static IsUniqueViolation ( this db, DbException ex, string keyName = null ) : bool
db this
ex System.Data.Common.DbException
keyName string
return bool