Skip to content

Commit

Permalink
Restore linking between chaildren and parent contexts (#1945)
Browse files Browse the repository at this point in the history
  • Loading branch information
guffy1234 committed May 24, 2022
1 parent 14dd363 commit 7322629
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/FluentValidation/Validators/ChildValidatorAdaptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ public class ChildValidatorAdaptor<T,TProperty> : NoopPropertyValidator<T,TPrope

public string[] RuleSets { get; set; }

internal bool PassThroughParentContext { get; set; }

public ChildValidatorAdaptor(IValidator<TProperty> validator, Type validatorType) {
_validator = validator;
ValidatorType = validatorType;
Expand Down Expand Up @@ -99,7 +97,7 @@ public class ChildValidatorAdaptor<T,TProperty> : NoopPropertyValidator<T,TPrope

protected virtual IValidationContext CreateNewValidationContextForChildValidator(ValidationContext<T> context, TProperty value) {
var selector = GetSelector(context, value);
var newContext = context.CloneForChildValidator(value, PassThroughParentContext, selector);
var newContext = context.CloneForChildValidator(value, true, selector);

if(!context.IsChildCollectionContext)
newContext.PropertyChain.Add(context.RawPropertyName);
Expand Down

0 comments on commit 7322629

Please sign in to comment.