Interface IBatchValidator<T>
- Namespace
- Visus.AddressValidation.Validation
- Assembly
- Visus.AddressValidation.dll
Defines a validator that produces one independent IValidationResult per item in a batch response.
public interface IBatchValidator<in T> where T : class
Type Parameters
TThe type of object to validate.
Methods
ExecuteAsync(T, IReadOnlyList<int>, CancellationToken)
Executes validation against the specified instance, producing one result per expected item.
ValueTask<IReadOnlyList<IValidationResult>> ExecuteAsync(T instance, IReadOnlyList<int> requestIndexes, CancellationToken cancellationToken = default)
Parameters
instanceTThe instance which will be validated against.
requestIndexesIReadOnlyList<int>The original, caller-facing index of each request actually sent to the API, in the same order the requests were sent. Its count is the number of items expected in the result; implementations should use the values themselves (rather than the positional loop index) when a validation message needs to reference an item's position, since requests that failed local validation may have been filtered out before the API call.
cancellationTokenCancellationTokenA cancellation token that can be used to cancel the work.
Returns
- ValueTask<IReadOnlyList<IValidationResult>>
A list of exactly
requestIndexes.CountIValidationResult objects, positionally aligned with the items sent to the API.