-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only run rules for property being validated
- Loading branch information
1 parent
c2efc1c
commit a76ede9
Showing
2 changed files
with
33 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/Blazored.FluentValidation/IntersectingCompositeValidatorSelector.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using FluentValidation; | ||
using FluentValidation.Internal; | ||
|
||
namespace Blazored.FluentValidation; | ||
|
||
internal class IntersectingCompositeValidatorSelector : IValidatorSelector { | ||
private readonly IEnumerable<IValidatorSelector> _selectors; | ||
|
||
public IntersectingCompositeValidatorSelector(IEnumerable<IValidatorSelector> selectors) { | ||
_selectors = selectors; | ||
} | ||
|
||
public bool CanExecute(IValidationRule rule, string propertyPath, IValidationContext context) { | ||
return _selectors.All(s => s.CanExecute(rule, propertyPath, context)); | ||
} | ||
} |