/// <summary> /// 删除标签与内容项的关联 /// </summary> /// <param name="itemInTagId">内容项与标签关联Id</param> public void DeleteTagFromItem(long itemInTagId) { ItemInTag itemInTag = itemInTagRepository.Get(itemInTagId); EventBus <ItemInTag> .Instance().OnBefore(itemInTag, new CommonEventArgs(EventOperationType.Instance().Delete())); itemInTagRepository.Delete(itemInTag); EventBus <ItemInTag> .Instance().OnAfter(itemInTag, new CommonEventArgs(EventOperationType.Instance().Delete())); }
/// <summary> /// 删除标签与内容项的关联 /// </summary> /// <param name="itemInTagId">内容项与标签关联Id</param> public void DeleteTagFromItem(long itemInTagId) { ItemInTag itemInTag = itemInTagRepository.Get(itemInTagId); EventBus <ItemInTag> .Instance().OnBefore(itemInTag, new CommonEventArgs(EventOperationType.Instance().Delete())); TagInOwner tagInOwner = tagInOwnerReposiory.Get(itemInTag.TagInOwnerId); if (tagInOwner != null && tagInOwner.ItemCount <= 1) { tagInOwnerReposiory.Delete(tagInOwner); } itemInTagRepository.Delete(itemInTag); EventBus <ItemInTag> .Instance().OnAfter(itemInTag, new CommonEventArgs(EventOperationType.Instance().Delete())); }