public void DeleteForm(string keyValue) { if (service.IQueryable().Count(t => t.F_ParentId.Equals(keyValue)) > 0) { throw new Exception("删除失败!操作的对象包含了下级数据。"); } else { service.DeleteForm(keyValue);//级联删除 } }