Photomechanics API
IAsyncDisposableExtended Interface Reference

Extended IAsyncDisposable interface with additional object state info providers and specific implementation pattern expected from implementation. Should be used for heavy and complex hardware API objects with complex dispose routines like cameras. IAsyncDisposable.DisposeAsync implementation should either 1) Set IsDisposed to true, perform resource cleanup and logging associated with it and invoke Disposed event in the end. 2) If disposal is already in progress, await its completion. This way, any caller of IAsyncDisposable.DisposeAsync can assume that disposal was fully complete after awaiting the call, even when used concurrently. More...

Inheritance diagram for IAsyncDisposableExtended:
[legend]

Properties

Boolean IsDisposed [get]
 Determines whether the object is being disposed or already disposed and no longer functional. More...
 
ILogger Logger [get]
 Logger associated with this instance. This way extension methods can use logging without requiring it as parameter. More...
 

Events

AsyncTypedEventHandler< IAsyncDisposableExtendedDisposed
 Occurs when object is disposed. It should be invoked at the end of IAsyncDisposable.DisposeAsync implementation in a Fire-and-Forget fashion (non-blocking).
 

Detailed Description

Extended IAsyncDisposable interface with additional object state info providers and specific implementation pattern expected from implementation. Should be used for heavy and complex hardware API objects with complex dispose routines like cameras. IAsyncDisposable.DisposeAsync implementation should either 1) Set IsDisposed to true, perform resource cleanup and logging associated with it and invoke Disposed event in the end. 2) If disposal is already in progress, await its completion. This way, any caller of IAsyncDisposable.DisposeAsync can assume that disposal was fully complete after awaiting the call, even when used concurrently.

Instead of directly implementing this interface, it is recommended to inherit from AsyncDisposableExtendedBase which provides implementation of aforementioned logic. If that is not possible, use AsyncDisposableExtendedImpl instead.

Property Documentation

◆ IsDisposed

Boolean IAsyncDisposableExtended.IsDisposed
get

Determines whether the object is being disposed or already disposed and no longer functional.

Returns
true when object is being disposed or disposed, false when not disposed.

Implemented in AsyncDisposableExtendedBase.

◆ Logger

ILogger IAsyncDisposableExtended.Logger
get

Logger associated with this instance. This way extension methods can use logging without requiring it as parameter.

Implemented in AsyncDisposableExtendedBase.