mirror of https://github.com/abpframework/abp.git
1 changed files with 17 additions and 4 deletions
@ -1,15 +1,28 @@ |
|||||
using System; |
using System; |
||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
using System.Linq; |
using System.ComponentModel.DataAnnotations; |
||||
using System.Text; |
using Volo.CmsKit.Tags; |
||||
using System.Threading.Tasks; |
|
||||
|
|
||||
namespace Volo.CmsKit.Admin.Tags; |
namespace Volo.CmsKit.Admin.Tags; |
||||
|
|
||||
[Serializable] |
[Serializable] |
||||
public class EntityTagSetDto |
public class EntityTagSetDto : IValidatableObject |
||||
{ |
{ |
||||
public string EntityId { get; set; } |
public string EntityId { get; set; } |
||||
public string EntityType { get; set; } |
public string EntityType { get; set; } |
||||
public List<string> Tags { get; set; } |
public List<string> Tags { get; set; } |
||||
|
|
||||
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
||||
|
{ |
||||
|
foreach (var tag in Tags) |
||||
|
{ |
||||
|
if (tag.Length > TagConsts.MaxNameLength) |
||||
|
{ |
||||
|
yield return new ValidationResult( |
||||
|
$"{nameof(tag)} length must be equal to or lower than {TagConsts.MaxNameLength}", |
||||
|
new[] { nameof(Tags) } |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
} |
} |
||||
|
|||||
Loading…
Reference in new issue