+
diff --git a/samples/Shared/SharedModels/Person.cs b/samples/Shared/SharedModels/Person.cs
index 412ae40..7de8f5c 100644
--- a/samples/Shared/SharedModels/Person.cs
+++ b/samples/Shared/SharedModels/Person.cs
@@ -9,6 +9,8 @@ public class Person
public int? Age { get; set; }
public string? EmailAddress { get; set; }
public Address Address { get; set; } = new();
+ public int StartLuckyNumberRange { get; set; }
+ public int EndLuckyNumberRange { get; set; }
}
public class PersonValidator : AbstractValidator
@@ -36,6 +38,9 @@ public PersonValidator()
.EmailAddress().WithMessage("You must provide a valid email address")
.MustAsync(async (email, _) => await IsUniqueAsync(email)).WithMessage("Email address must be unique");
+ RuleFor(p => p.StartLuckyNumberRange).LessThan(p => p.EndLuckyNumberRange).WithMessage("Start lucky number must be less than end lucky number");
+ RuleFor(p => p.EndLuckyNumberRange).GreaterThan(p => p.StartLuckyNumberRange).WithMessage("End lucky number must be greater than start lucky number");
+
RuleFor(p => p.Address).SetValidator(new AddressValidator());
}
diff --git a/src/Blazored.FluentValidation/EditContextFluentValidationExtensions.cs b/src/Blazored.FluentValidation/EditContextFluentValidationExtensions.cs
index c06c9f4..206e769 100644
--- a/src/Blazored.FluentValidation/EditContextFluentValidationExtensions.cs
+++ b/src/Blazored.FluentValidation/EditContextFluentValidationExtensions.cs
@@ -1,5 +1,6 @@
using FluentValidation;
using FluentValidation.Internal;
+using FluentValidation.Validators;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.Extensions.DependencyInjection;
using static FluentValidation.AssemblyScanner;
@@ -76,15 +77,45 @@ private static async Task ValidateField(EditContext editContext,
{
var properties = new[] { fieldIdentifier.FieldName };
var context = new ValidationContext