Table of Contents

Interface IResourceReference<TValue>

Namespace
Acuit.Pinpoint.ResourceManagement
Assembly
Acuit.Pinpoint.ResourceManagement.Abstractions.dll

A reference to a resource. When the reference is no longer needed, it should be disposed.

public interface IResourceReference<TValue> : IDisposable

Type Parameters

TValue

The resource value type.

Inherited Members

Methods

GetChangeToken()

Returns a IChangeToken that can be used to observe when this resource value changes.

IChangeToken GetChangeToken()

Returns

IChangeToken

A IChangeToken.

Remarks

The proper way to ensure all changes are noted is to always first call GetChangeToken() to retrieve the change token to use to watch for changes before retrieving the resource value via GetValueAsync(CancellationToken).

Exceptions

ObjectDisposedException

The object has been disposed. This can occur when either this reference has been disposed or when the provider of the referenced resource has been disposed.

GetValueAsync(CancellationToken)

Gets the resource value.

Task<TValue> GetValueAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A cancellation token that can be used to request canceling retrieving the resource.

Returns

Task<TValue>

The task object representing the asynchronous operation.

Remarks

Once the operation completes, the Result property on the returned task object contains the resource value.

Exceptions

ObjectDisposedException

The object has been disposed. This can occur when either this reference has been disposed or when the provider of the referenced resource has been disposed.

Exception

The resource could not be retrieved. Specific exceptions depend on the implementation.