-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
154bafc
commit 4d634c8
Showing
9 changed files
with
245 additions
and
42 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
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
8 changes: 8 additions & 0 deletions
8
src/FluentValidation/BitzArt.FluentValidation.Extensions/Interfaces/IActionValidator.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 |
---|---|---|
@@ -1,11 +1,19 @@ | ||
namespace FluentValidation; | ||
|
||
/// <inheritdoc cref="IActionValidator"/> | ||
/// <typeparam name="T">The type of object being validated.</typeparam> | ||
public interface IActionValidator<T> : IValidator<T>, IActionValidator | ||
{ | ||
|
||
} | ||
|
||
/// <summary> | ||
/// An <see cref="IValidator"/> that can be used to validate an object based on the action being performed. | ||
/// </summary> | ||
public interface IActionValidator | ||
{ | ||
/// <summary> | ||
/// Current action type. | ||
/// </summary> | ||
public ActionType? Action { get; internal set; } | ||
} |
37 changes: 21 additions & 16 deletions
37
src/FluentValidation/BitzArt.FluentValidation.Extensions/Services/ActionValidatorFactory.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
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
18 changes: 18 additions & 0 deletions
18
src/FluentValidation/BitzArt.FluentValidation.Extensions/Services/ValidatorMapEntry.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,18 @@ | ||
namespace FluentValidation; | ||
|
||
internal record ValidatorMapEntry | ||
{ | ||
public Type ImplementationType { get; } | ||
public Func<IServiceProvider, ActionType>? ActionTypeResolver { get; } | ||
public ActionType? DefinedActionType { get; } | ||
|
||
public ValidatorMapEntry(Type ImplementationType, Func<IServiceProvider, ActionType>? ActionTypeResolver = null, ActionType? DefinedActionType = null) | ||
{ | ||
ArgumentNullException.ThrowIfNull(ImplementationType, nameof(ImplementationType)); | ||
if (ActionTypeResolver is null && DefinedActionType is null) throw new ArgumentException("Either ActionTypeResolver or DefinedActionType must be provided"); | ||
|
||
this.ImplementationType = ImplementationType; | ||
this.ActionTypeResolver = ActionTypeResolver; | ||
this.DefinedActionType = DefinedActionType; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
src/FluentValidation/BitzArt.FluentValidation.Extensions/Validators/ActionValidator.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
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
Oops, something went wrong.