Пример #1
0
        public static void HandleSavePrimaryKeyException(Exception e, ITextLocalizer localizer, string fieldName = "ID")
        {
            PrimaryKeyExceptionInfo fk;

            if (SqlExceptionHelper.IsPrimaryKeyException(e, out fk))
            {
                throw new ValidationError(String.Format(Texts.Validation.SavePrimaryKeyError.ToString(localizer), fk.TableName, fieldName));
            }
        }
Пример #2
0
        public static void HandleDeleteForeignKeyException(Exception e, ITextLocalizer localizer)
        {
            ForeignKeyExceptionInfo fk;

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