Browse Source

add checks and code fixes.

pull/7806/head
Ilkay Ilknur 5 years ago
parent
commit
0d3889cbe7
  1. 32
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Contents/Content.cs
  2. 2
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/Page.cs
  3. 4
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Tags/Tag.cs

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

@ -8,41 +8,37 @@ 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; }
[NotNull]
public virtual string EntityId { get; protected set; }
[NotNull]
public virtual string Value { get; protected set; }
[CanBeNull] public virtual Guid? TenantId { get; protected set; }
[NotNull] public virtual string EntityType { get; protected set; }
[NotNull] public virtual string EntityId { get; protected set; }
[NotNull] public virtual string Value { get; protected set; }
protected Content()
{
}
public Content(Guid id, [NotNull] string entityType, [NotNull] string entityId, [NotNull] string value, Guid? tenantId = null) : base(id)
public Content(Guid id, [NotNull] string entityType, [NotNull] string entityId, [NotNull] string value,
Guid? tenantId = null) : base(id)
{
EntityId = Check.NotNullOrWhiteSpace(entityId, nameof(entityId), ContentConsts.MaxEntityIdLength);
EntityType = Check.NotNullOrEmpty(entityType, nameof(entityType), ContentConsts.MaxEntityTypeLength);
Value = Check.NotNullOrEmpty(value, nameof(value), ContentConsts.MaxValueLength);
TenantId = tenantId;
}
public void SetValue([NotNull] string value)
public virtual void SetValue([NotNull] string value)
{
Value = Check.NotNullOrEmpty(value, nameof(value), ContentConsts.MaxValueLength);
}
public void SetEntity([NotNull] string entityType, [NotNull] string entityId)
public virtual void SetEntity([NotNull] string entityType, [NotNull] string entityId)
{
EntityType = Check.NotNullOrEmpty(entityType, nameof(entityType), ContentConsts.MaxEntityTypeLength);
EntityId = Check.NotNullOrWhiteSpace(entityId, nameof(entityId), ContentConsts.MaxEntityIdLength);
}
}
}
}

2
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Pages/Page.cs

@ -8,7 +8,7 @@ namespace Volo.CmsKit.Pages
{
public class Page : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
[CanBeNull] public virtual Guid? TenantId { get; set; }
[CanBeNull] public virtual Guid? TenantId { get; protected set; }
[NotNull] public virtual string Title { get; protected set; }

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

@ -8,7 +8,7 @@ namespace Volo.CmsKit.Tags
{
public class Tag : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
public virtual Guid? TenantId { get; set; }
public virtual Guid? TenantId { get; protected set; }
[NotNull]
public virtual string EntityType { get; protected set; }
@ -33,7 +33,7 @@ namespace Volo.CmsKit.Tags
public virtual void SetName(string name)
{
Name = Check.NotNullOrWhiteSpace(name, nameof(name), TagConsts.MaxNameLength);
Name = Check.NotNullOrEmpty(name, nameof(name), TagConsts.MaxNameLength);
}
public virtual void SetEntityType(string entityType)

Loading…
Cancel
Save