diff --git a/src/Blazored.FluentValidation/FluentValidationsValidator.cs b/src/Blazored.FluentValidation/FluentValidationsValidator.cs index ae8e6f9..8e9ddd0 100644 --- a/src/Blazored.FluentValidation/FluentValidationsValidator.cs +++ b/src/Blazored.FluentValidation/FluentValidationsValidator.cs @@ -14,6 +14,7 @@ public class FluentValidationValidator : ComponentBase [CascadingParameter] private EditContext? CurrentEditContext { get; set; } [Parameter] public IValidator? Validator { get; set; } + [Parameter] public IValidator[]? Validators { get; set; } [Parameter] public bool DisableAssemblyScanning { get; set; } [Parameter] public Action>? Options { get; set; } internal Action>? ValidateOptions { get; set; } @@ -79,6 +80,12 @@ protected override void OnInitialized() $"inside an {nameof(EditForm)}."); } + if (Validators?.Any() == true) + { + foreach (var validator in Validators) + CurrentEditContext.AddFluentValidation(ServiceProvider, DisableAssemblyScanning, validator, this); + } + CurrentEditContext.AddFluentValidation(ServiceProvider, DisableAssemblyScanning, Validator, this); } } \ No newline at end of file