IOperation<T>
An interface used by OperationInternal<T> for making service calls and updating state. It's expected that
your long-running operation classes implement this interface.
Calls the service and updates the state of the long-running operation. Properties directly handled by the
OperationInternal<T> class, such as RawResponse or
Value, don't need to be updated. Operation-specific properties, such
as "CreateOn" or "LastModified", must be manually updated by the operation implementing this
method.
Usage example:
async ValueTask<OperationState<T>> IOperation<T>.UpdateStateAsync(bool async, CancellationToken cancellationToken)
{
Response<R> response = async ? <async service call> : <sync service call>;
if (<operation succeeded>) return OperationState<T>.Success(response.GetRawResponse(), <parse response>);
if (<operation failed>) return OperationState<T>.Failure(response.GetRawResponse());
return OperationState<T>.Pending(response.GetRawResponse());
}