Class AsyncValidationRule<T>
Represents an asynchronous validation rule and its error message.
Inheritance
AsyncValidationRule<T>
Assembly: ValidationFramework.dll
Syntax
public class AsyncValidationRule<T>
Type Parameters
Constructors
|
Edit this page
View Source
AsyncValidationRule(Func<T, CancellationToken, Task<bool>>, string)
Creates an asynchronous rule that receives the caller's cancellation token.
Declaration
public AsyncValidationRule(Func<T, CancellationToken, Task<bool>> rule, string errorMessage)
Parameters
|
Edit this page
View Source
AsyncValidationRule(Func<T, Task<bool>>, string)
Creates an asynchronous validation rule.
Declaration
public AsyncValidationRule(Func<T, Task<bool>> rule, string errorMessage)
Parameters
Methods
|
Edit this page
View Source
ValidateAsync(T)
Validates a value asynchronously.
Declaration
public Task<(bool isValid, string error)> ValidateAsync(T value)
Parameters
| Type |
Name |
Description |
| T |
value |
|
Returns
|
Edit this page
View Source
ValidateAsync(T, CancellationToken)
Validates a value and stops waiting when canceled. Rules should honor the token
to stop any underlying I/O as well.
Declaration
public Task<(bool isValid, string error)> ValidateAsync(T value, CancellationToken cancellationToken)
Parameters
Returns