Validation Framework
Search Results for

    Show / Hide Table of Contents

    Class AsyncValidationRule<T>

    Represents an asynchronous validation rule and its error message.

    Inheritance
    object
    AsyncValidationRule<T>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: ValidationFramework
    Assembly: ValidationFramework.dll
    Syntax
    public class AsyncValidationRule<T>
    Type Parameters
    Name Description
    T

    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
    Type Name Description
    Func<T, CancellationToken, Task<bool>> rule
    string errorMessage
    | 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
    Type Name Description
    Func<T, Task<bool>> rule
    string errorMessage

    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
    Type Description
    Task<(bool isValid, string error)>
    | 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
    Type Name Description
    T value
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<(bool isValid, string error)>
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX