using FluentValidation; using TakeoutSaaS.Application.App.Tenants.Commands; namespace TakeoutSaaS.Application.App.Tenants.Validators; /// /// 更新公告命令验证器。 /// public sealed class UpdateAnnouncementCommandValidator : AbstractValidator { /// /// 初始化验证规则。 /// public UpdateAnnouncementCommandValidator() { RuleFor(x => x.Title) .NotEmpty() .MaximumLength(128); RuleFor(x => x.Content) .NotEmpty(); RuleFor(x => x.RowVersion) .NotNull() .Must(rowVersion => rowVersion != null && rowVersion.Length > 0) .WithMessage("RowVersion 不能为空"); } }