protected virtual void PerformValidation( Action <string> addValidationErrorAction, ValidatorType type, IViewModel owner, IViewModel targetVM, object validatorKey, IVMPropertyDescriptor targetProperty = null ) { var invocation = new ValidatorInvocation(type, owner, targetVM, null, targetProperty, validatorKey); var errors = ValidatorSetups .Where(x => x.Invocation.Equals(invocation)) .SelectMany(x => x.Result.Errors); errors.ForEach(x => addValidationErrorAction(x.Message)); ActualInvocations.Add( new ValidatorInvocation(type, owner, targetVM, null, targetProperty, validatorKey) ); }
protected virtual void PerformCollectionValidation <TItemVM>( Action <TItemVM, string, object> addValidationErrorAction, ValidatorType type, IViewModel owner, IVMCollectionBase <TItemVM> targetCollection, object validatorKey, IVMPropertyDescriptor targetProperty = null ) where TItemVM : IViewModel { foreach (TItemVM item in targetCollection) { var invocation = new ValidatorInvocation(type, owner, item, null, targetProperty, validatorKey); var errors = ValidatorSetups .Where(x => x.Invocation.Equals(invocation)) .SelectMany(x => x.Result.Errors); errors.ForEach(x => addValidationErrorAction(item, x.Message, x.Details)); } ActualInvocations.Add( new ValidatorInvocation(type, owner, null, targetCollection, targetProperty, validatorKey) ); }