Search Results for

    Show / Hide Table of Contents

    Interface IDisposeOnFinished

    Accepts disposable objects, which will be automatically disposed when the implementer finishes, or will be disposed immediately if the implementer has already finished.

    See DisposeOnFinished<TDisposable>(TDisposable) for the exact definition of 'finished'. Also see Disposing Disposables.

    Namespace: actionETL
    Assembly: actionETL.dll
    Syntax
    public interface IDisposeOnFinished
    Examples

    Adb Keep Open Connection has examples of how to use the interface.

    Methods

    DisposeOnFinished<TDisposable>(TDisposable)

    Adds the specified disposable to the list of objects to be disposed when either of the following occur, whichever comes first:

    A: The worker (or WorkerSystem) completes after having run, or B: the worker never runs, and either the worker is removed from its parent, or the worker parent completes.

    If either of the above has already taken place, the object will be disposed immediately.

    For workers that have been started, the disposal will always happen after its AddCompletedCallback(Func<WorkerBase, OutcomeStatus, Task<OutcomeStatus>>) callbacks (if any) run, and for the WorkerSystem, just before Start() / StartAsync() finishes. Note however that if a worker is never started, any AddCompletedCallback(Func<WorkerBase, OutcomeStatus, Task<OutcomeStatus>>) callbacks won't be called.

    Do not add any worker result property instance (e.g. Rows if it had been disposable) as a disposable, since that would dispose the object before any ancestor could retrieve the result.

    Declaration
    TDisposable DisposeOnFinished<TDisposable>(TDisposable disposable)
        where TDisposable : IDisposable
    Parameters
    Type Name Description
    TDisposable disposable

    The disposable object. Ignored if null.

    Returns
    Type Description
    TDisposable

    The specified disposable. This allows using or assigning the disposable directly, e.g.:

    var connection = DisposeOnFinished(connectionBuilder.Create());
    Type Parameters
    Name Description
    TDisposable

    The type of the disposable.

    Examples

    Adb Keep Open Connection has examples of how to use this class.

    In This Article
    Back to top Copyright © 2021 Envobi Ltd