Language

ValidationRequestedEventArgs.AddAsyncValidator Method

Definition

Registers an asynchronous validation to be run and awaited as part of the current validation pass.

public void AddAsyncValidator(Func<System.Threading.CancellationToken,System.Threading.Tasks.Task> validator);
member this.AddAsyncValidator : Func<System.Threading.CancellationToken, System.Threading.Tasks.Task> -> unit
Public Sub AddAsyncValidator (validator As Func(Of CancellationToken, Task))

Parameters

validator
Func<CancellationToken,Task>

A validator method that starts the asynchronous validation work and returns the resulting Task. It is invoked by ValidateAsync(CancellationToken) with the validation pass's cancellation token, and the returned task is awaited before the pass completes. The method must not return a null task.

Exceptions

validator is null.

validator returned null, or this is the shared non-async Empty instance.

Applies to