Browse Source

added id parameter to tag constructor

pull/6858/head
Ahmet 6 years ago
parent
commit
dfe9ea40dd
  1. 1
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs
  2. 3
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs
  3. 4
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs

1
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/ITagManager.cs

@ -10,6 +10,7 @@ namespace Volo.CmsKit.Tags
public interface ITagManager : IDomainService
{
Task<Tag> InsertAsync(
Guid id,
[NotNull] string entityType,
[NotNull] string name,
Guid? tenantId = null,

3
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs

@ -19,9 +19,10 @@ namespace Volo.CmsKit.Tags
}
public Tag(
Guid id,
[NotNull] string entityType,
[NotNull] string name,
Guid? tenantId = null)
Guid? tenantId = null) : base(id)
{
EntityType = Check.NotNullOrWhiteSpace(entityType, nameof(entityType), TagConsts.MaxEntityTypeLength);
SetName(name);

4
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/TagManager.cs

@ -26,13 +26,14 @@ namespace Volo.CmsKit.Tags
if (entity == null)
{
entity = await InsertAsync(entityType, name, tenantId, cancellationToken);
entity = await InsertAsync(GuidGenerator.Create(), entityType, name, tenantId, cancellationToken);
}
return entity;
}
public async Task<Tag> InsertAsync(
Guid id,
[NotNull] string entityType,
[NotNull] string name,
Guid? tenantId = null,
@ -45,6 +46,7 @@ namespace Volo.CmsKit.Tags
return await _tagRepository.InsertAsync(
new Tag(
id,
entityType,
name,
tenantId),

Loading…
Cancel
Save