public void AddTag(ITag tag) { Check.Argument.IsNotNull(tag, "tag"); Check.Argument.IsNotEmpty(tag.Id, "tag.Id"); Check.Argument.IsNotEmpty(tag.Name, "tag.Name"); if (!ContainsTag(tag)) { UserTagsInternal.Add((Tag)tag); } }
public bool ContainsTag(ITag tag) { Check.Argument.IsNotNull(tag, "tag"); Check.Argument.IsNotEmpty(tag.Name, "tag.Name"); var tagName = tag.Name; EntityHelper.EnsureEntityCollection(ref _userTags, UserTagsInternal); var srcQuery = _userTags.CreateSourceQuery(); return(UserTagsInternal.Any(t => t.Name == tagName) || (srcQuery != null && srcQuery.Any(t => t.Name == tagName))); }