Skip to content

Commit

Permalink
Passing parent model instead of nested type to resolve exception thro…
Browse files Browse the repository at this point in the history
…wn by FluentValidation

Fixes Blazored#76
  • Loading branch information
icnocop committed Oct 3, 2023
1 parent ef26fc1 commit 1b94b84
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ private static async Task ValidateField(EditContext editContext,
IValidator? validator = null)
{
var properties = new[] { fieldIdentifier.FieldName };
var context = new ValidationContext<object>(fieldIdentifier.Model, new PropertyChain(), new MemberNameValidatorSelector(properties));
var context = new ValidationContext<object>(editContext.Model, new PropertyChain(), new MemberNameValidatorSelector(properties));

validator ??= GetValidatorForModel(serviceProvider, fieldIdentifier.Model, disableAssemblyScanning);
validator ??= GetValidatorForModel(serviceProvider, editContext.Model, disableAssemblyScanning);

if (validator is not null)
{
Expand Down

0 comments on commit 1b94b84

Please sign in to comment.