Example #1
0
        public virtual async Task <EntityTag> AddTagToEntityAsync(
            [NotNull] Guid tagId,
            [NotNull] string entityType,
            [NotNull] string entityId,
            [CanBeNull] Guid?tenantId           = null,
            CancellationToken cancellationToken = default)
        {
            if (!await TagDefinitionStore.IsDefinedAsync(entityType))
            {
                throw new EntityNotTaggableException(entityType);
            }

            var entityTag = new EntityTag(tagId, entityId, tenantId);

            return(await EntityTagRepository.InsertAsync(entityTag, cancellationToken : cancellationToken));
        }