Browse Source

domain object refactoring

pull/7755/head
Ilkay Ilknur 6 years ago
parent
commit
47549c9a74
  1. 18
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/Content.cs

18
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/Content.cs

@ -8,12 +8,16 @@ namespace Volo.CmsKit.Contents
{
public class Content : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
[CanBeNull]
public virtual Guid? TenantId { get; protected set; }
[NotNull]
public virtual string EntityType { get; protected set; }
public virtual string EntityId { get; set; }
[NotNull]
public virtual string EntityId { get; protected set; }
[NotNull]
public virtual string Value { get; protected set; }
protected Content()
@ -23,16 +27,22 @@ namespace Volo.CmsKit.Contents
public Content(Guid id, [NotNull] string entityType, [NotNull] string entityId, [NotNull] string value, Guid? tenantId = null) : base(id)
{
EntityType = Check.NotNullOrWhiteSpace(entityType, nameof(entityType), ContentConsts.MaxEntityTypeLength);
EntityId = Check.NotNullOrWhiteSpace(entityId, nameof(entityId), ContentConsts.MaxEntityIdLength);
SetValue(value);
EntityType = Check.NotNullOrEmpty(entityType, nameof(entityType), ContentConsts.MaxEntityTypeLength);
Value = Check.NotNullOrEmpty(value, nameof(value), ContentConsts.MaxValueLength);
TenantId = tenantId;
}
public void SetValue([NotNull] string value)
{
Value = Check.NotNullOrWhiteSpace(value, nameof(value), ContentConsts.MaxValueLength);
Value = Check.NotNullOrEmpty(value, nameof(value), ContentConsts.MaxValueLength);
}
public void SetEntity([NotNull] string entityType, [NotNull] string entityId)
{
EntityType = Check.NotNullOrEmpty(entityType, nameof(entityType), ContentConsts.MaxEntityTypeLength);
EntityId = Check.NotNullOrWhiteSpace(entityId, nameof(entityId), ContentConsts.MaxEntityIdLength);
}
}
}

Loading…
Cancel
Save