using System.ComponentModel.DataAnnotations; using FluentValidation; namespace BlazorEditForms.Model; public class PhoneNumber { [Phone] public string Number { get; set; } = string.Empty; public PhoneNumberType Type { get; set; } } public class PhoneNumberValidator : AbstractValidator { public PhoneNumberValidator() { RuleFor(x => x.Number).NotEmpty().Matches(@"\+?\d+"); RuleFor(x => x.Type).IsInEnum(); } }