/// <summary> /// Checks for possible FK constraint violations prior to deleting a record /// If return is FALSE the delete is aborted /// </summary> /// <param name="entity"></param> /// <returns>bool</returns> protected override bool HookPreDeleteEntity(SQLTracGrpEntity entity) { bool bReturn = base.HookPreDeleteEntity(entity); if (bReturn) { // check to see if this type is used by a group or resource string sCommand = "[dbo].[sp_SQLTrac_CanDeleteGrp]"; if ((int)this.ExecSprocScalar(sCommand, this.CreateParameter("@GrpID", (object)entity.GrpID, DbType.Int16)) == 0 ) { this.Rules.EntityPropertyDisplayName = "Group - "+entity.GrpName; string sMsg = "Unable to delete " + this.Rules.EntityPropertyDisplayName; sMsg += ". This group is contains resource entries and/or child groups."; this.Rules.AddErrorProviderBrokenRule("GrpName", sMsg); bReturn = false; } } return bReturn; }So if the DeleteEntity() method returns a false, I can check the rules collection and pick up the message.