Skip to content

DataValidation.ValidateObjectAsync method

Validates an object, like ValidateObject, awaiting the rules that can be checked asynchronously.

public static Task ValidateObjectAsync(object instance, ObjectValidationOptions? options = null, 
    ITextLocalizer? localizer = null, CancellationToken cancellationToken = default)
parameter description
instance The object.
options How it is validated, e.g. by the rules of a form.
localizer Text localizer of the message of a required value.
cancellationToken The cancellation token.

Exceptions

exception condition
ValidationError A property of the object is not valid.

See Also