-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Good day,
I was hoping someone can kindly help me with this issue, how would correctly validate an IP Address using FluentValidation.
Does FluentValidation have such functionality?
public abstract class GatewayValidation<T> : AbstractValidator<T> where T : GatewayCommand
{
protected void ValidateName()
{
RuleFor(g => g.Name)
.NotEmpty().WithMessage("Please ensure you have entered the Name")
.Length(2, 16).WithMessage("The Name must have between 2 and 16 characters");
}
protected void ValidateIPAddress()
{
RuleFor(g => g.IPAddress)
.NotEmpty().WithMessage("IP address format is invalid");
}
protected void ValidateId()
{
RuleFor(g => g.Id)
.NotEqual(Guid.Empty);
}
}
Metadata
Metadata
Assignees
Labels
No labels