public static void HandleSavePrimaryKeyException(Exception e, string fieldName = "ID") { PrimaryKeyExceptionInfo fk; if (SqlExceptionHelper.IsPrimaryKeyException(e, out fk)) { throw new ValidationError(String.Format(BusinessTexts.Validation.SavePrimaryKeyError, fk.TableName, fieldName)); } }
public static void HandleDeleteForeignKeyException(Exception e) { ForeignKeyExceptionInfo fk; if (SqlExceptionHelper.IsForeignKeyException(e, out fk)) { throw new ValidationError(String.Format(BusinessTexts.Validation.DeleteForeignKeyError, fk.TableName)); } }