Exemple #1
0
        public static void HandleSavePrimaryKeyException(Exception e, string fieldName = "ID")
        {
            PrimaryKeyExceptionInfo fk;

            if (SqlExceptionHelper.IsPrimaryKeyException(e, out fk))
            {
                throw new ValidationError(String.Format(Texts.Validation.SavePrimaryKeyError, fk.TableName, fieldName));
            }
        }
Exemple #2
0
        public static void HandleDeleteForeignKeyException(Exception e)
        {
            ForeignKeyExceptionInfo fk;

            if (SqlExceptionHelper.IsForeignKeyException(e, out fk))
            {
                throw new ValidationError(String.Format(Texts.Validation.DeleteForeignKeyError, fk.TableName));
            }
        }