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 (#91)
  • Loading branch information
icnocop authored Oct 22, 2021
1 parent 45485a7 commit b862dfc
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ private static async void 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 object)
{
Expand Down

0 comments on commit b862dfc

Please sign in to comment.