Search Results for

    Show / Hide Table of Contents

    Class WorkerParentStatus

    Describes the execution status of a WorkerParent.

    Note: If a DbException is passed to the static factory methods, database specific exception details will be automatically added to the Message property.

    Inheritance
    Object
    WorkerParentStatus
    Implements
    IOutcomeStatus
    Namespace: actionETL
    Assembly: actionETL.dll
    Syntax
    public sealed class WorkerParentStatus : IOutcomeStatus

    Properties

    Category

    Gets the category, if any, which describes what generated the status. Guaranteed to not be null.

    Declaration
    public string Category { get; }
    Property Value
    Type Description
    String

    Created

    Gets an immutable WorkerParentStatus instance with the Created status. This can e.g. be used when returning this status from a (potentially asynchronous) method.

    Note: Always use the Is* properties (IsSucceeded, IsCompleted etc.), or use the State property to check the status. I.e. do not compare with this immutable instance (since there can be other instances, with e.g. InnerStatuses populated).

    Declaration
    public static WorkerParentStatus Created { get; }
    Property Value
    Type Description
    WorkerParentStatus

    CreatedTask

    Gets a completed Task with an immutable WorkerParentStatus instance with the Created status. This is typically used when returning this status from a non-async method that has a Task<WorkerParentStatus> return type.

    Note: Always use the Is* properties (IsSucceeded, IsCompleted etc.), or use the State property to check the status. I.e. do not compare with this immutable instance (since there can be other instances, with e.g. InnerStatuses populated).

    Declaration
    public static Task<WorkerParentStatus> CreatedTask { get; }
    Property Value
    Type Description
    Task<WorkerParentStatus>

    Exception

    Gets the exception that caused the failure, or null if either no exception was thrown, or it was thrown but was caught and not rethrown.

    Declaration
    public Exception Exception { get; }
    Property Value
    Type Description
    Exception

    The exception.

    Remarks

    Exception can be null even if the worker or worker system fails - this happens when an error condition is noticed without an exception having been thrown, e.g. when testing for and finding a null argument, logging the error, and returning an Error or Fatal status.

    InnerStatuses

    Gets the inner statuses, which only consists of failure statuses, or an empty list.

    Declaration
    public IImmutableList<IOutcomeStatus> InnerStatuses { get; }
    Property Value
    Type Description
    IImmutableList<IOutcomeStatus>

    IsCanceled

    Gets a value indicating whether the status is canceled.

    Declaration
    public bool IsCanceled { get; }
    Property Value
    Type Description
    Boolean

    true if the status is Canceled; otherwise, false.

    IsCompleted

    Gets a value indicating whether this instance is completed, i.e. is in a final state.

    Declaration
    public bool IsCompleted { get; }
    Property Value
    Type Description
    Boolean

    true if the status is Succeeded, Canceled, Error, or Fatal; otherwise, false.

    IsCreated

    Gets a value indicating whether the status is created, but has not progressed to any later state.

    Declaration
    public bool IsCreated { get; }
    Property Value
    Type Description
    Boolean

    true if the status is Created, but has not progressed to any later state; otherwise, false.

    IsError

    Gets a value indicating whether the status is an error.

    Declaration
    public bool IsError { get; }
    Property Value
    Type Description
    Boolean

    true if the status is Error; otherwise, false.

    IsFailed

    Gets a value indicating whether the status is in a failed completed state, i.e. Canceled, Error, or Fatal.

    Declaration
    public bool IsFailed { get; }
    Property Value
    Type Description
    Boolean

    true if the status is Canceled, Error, or Fatal; otherwise, false.

    IsFatal

    Gets a value indicating whether the status has fatally faulted.

    Declaration
    public bool IsFatal { get; }
    Property Value
    Type Description
    Boolean

    true if the status is Fatal; otherwise, false.

    IsRunning

    Gets a value indicating whether the status is running.

    Declaration
    public bool IsRunning { get; }
    Property Value
    Type Description
    Boolean

    true if the status is Running; otherwise, false.

    IsSucceeded

    Gets a value indicating whether the status is succeeded.

    Declaration
    public bool IsSucceeded { get; }
    Property Value
    Type Description
    Boolean

    true if the status is Succeeded; otherwise, false.

    Message

    Gets the message, if any, which provides supplementary information. Guaranteed to not be null.

    Declaration
    public string Message { get; }
    Property Value
    Type Description
    String

    Name

    Gets the WorkerParentStatus name, which is the same as the WorkerParentState name.

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    String

    Ordinal

    Gets the (0-based) OutcomeState ordinal.

    Declaration
    public int Ordinal { get; }
    Property Value
    Type Description
    Int32

    Running

    Gets an immutable WorkerParentStatus instance with the Running status. This can e.g. be used when returning this status from a (potentially asynchronous) method.

    Note: Always use the Is* properties (IsSucceeded, IsCompleted etc.), or use the State property to check the status. I.e. do not compare with this immutable instance (since there can be other instances, with e.g. InnerStatuses populated).

    Declaration
    public static WorkerParentStatus Running { get; }
    Property Value
    Type Description
    WorkerParentStatus

    RunningTask

    Gets a completed Task with an immutable WorkerParentStatus instance with the Running status. This is typically used when returning this status from a non-async method that has a Task<WorkerParentStatus> return type.

    Note: Always use the Is* properties (IsSucceeded, IsCompleted etc.), or use the State property to check the status. I.e. do not compare with this immutable instance (since there can be other instances, with e.g. InnerStatuses populated).

    Declaration
    public static Task<WorkerParentStatus> RunningTask { get; }
    Property Value
    Type Description
    Task<WorkerParentStatus>

    State

    Gets the state.

    Declaration
    public WorkerParentState State { get; }
    Property Value
    Type Description
    WorkerParentState

    Succeeded

    Gets an immutable WorkerParentStatus instance with the Succeeded status. This can e.g. be used when returning this status from a (potentially asynchronous) method.

    Note: Always use the Is* properties (IsSucceeded, IsCompleted etc.), or use the State property to check the status. I.e. do not compare with this immutable instance (since there can be other instances, with e.g. InnerStatuses populated).

    Declaration
    public static WorkerParentStatus Succeeded { get; }
    Property Value
    Type Description
    WorkerParentStatus

    SucceededTask

    Gets a completed Task with an immutable WorkerParentStatus instance with the Succeeded status. This is typically used when returning this status from a non-async method that has a Task<WorkerParentStatus> return type.

    Note: Always use the Is* properties (IsSucceeded, IsCompleted etc.), or use the State property to check the status. I.e. do not compare with this immutable instance (since there can be other instances, with e.g. InnerStatuses populated).

    Declaration
    public static Task<WorkerParentStatus> SucceededTask { get; }
    Property Value
    Type Description
    Task<WorkerParentStatus>

    Methods

    Canceled()

    Creates a Canceled status instance.

    Declaration
    public static WorkerParentStatus Canceled()
    Returns
    Type Description
    WorkerParentStatus

    The Canceled status instance.

    Canceled(String)

    Creates a Canceled status instance.

    Declaration
    public static WorkerParentStatus Canceled(string category)
    Parameters
    Type Name Description
    String category

    The category. Defaults to "Unset" if null.

    Returns
    Type Description
    WorkerParentStatus

    The Canceled status instance.

    Canceled(String, Exception)

    Creates a Canceled status instance.

    Declaration
    public static WorkerParentStatus Canceled(string category, Exception exception)
    Parameters
    Type Name Description
    String category

    The category. Defaults to "Unset" if null.

    Exception exception

    The exception. Can be null.

    Returns
    Type Description
    WorkerParentStatus

    The Canceled status instance.

    Canceled(String, Exception, String)

    Creates a Canceled status instance.

    Declaration
    public static WorkerParentStatus Canceled(string category, Exception exception, string message)
    Parameters
    Type Name Description
    String category

    The category. Defaults to "Unset" if null.

    Exception exception

    The exception. Can be null.

    String message

    The message. Defaults to an empty string if null.

    Returns
    Type Description
    WorkerParentStatus

    The Canceled status instance.

    Canceled(String, String)

    Creates a Canceled status instance.

    Declaration
    public static WorkerParentStatus Canceled(string category, string message)
    Parameters
    Type Name Description
    String category

    The category. Defaults to "Unset" if null.

    String message

    The message. Defaults to an empty string if null.

    Returns
    Type Description
    WorkerParentStatus

    The Canceled status instance.

    Combine(WorkerParentStatus)

    Combines the current instance with a second WorkerParentStatus instance by using the most severe as the primary one presented directly in properties, and retaining secondary statuses (if they are failure statuses) in InnerStatuses.

    Note that InnerStatuses can have (failure) statuses even if the main WorkerParentStatus.Status is WorkerParentStatus.Succeeded.

    Declaration
    public WorkerParentStatus Combine(WorkerParentStatus secondStatus)
    Parameters
    Type Name Description
    WorkerParentStatus secondStatus

    The second status.

    Returns
    Type Description
    WorkerParentStatus

    The combined WorkerParentStatus.

    Remarks

    Supplementary properties Category, Exception, and Message are only allowed for states Canceled, Error, and Fatal.

    The WorkerParentStatus properties are immutable, i.e. they can't themselves be modified after construction. Note however that any Exception object in the Exception property is a mutable reference type, and its properties can be modified. To avoid any issues with this, never modify the Exception object in an WorkerParentStatus instance that have been returned from this Combine method.

    Combine(Boolean, WorkerParentStatus)

    Combines the current instance with a second WorkerParentStatus instance by using one status as the primary one (usually the most severe one) presented directly in properties, and retaining secondary statuses (if they are failure statuses) in InnerStatuses.

    Note that InnerStatuses can have (failure) statuses even if the main WorkerParentStatus.Status is WorkerParentStatus.Succeeded.

    Declaration
    public WorkerParentStatus Combine(bool forceFirstStatus, WorkerParentStatus secondStatus)
    Parameters
    Type Name Description
    Boolean forceFirstStatus

    If set to false, the WorkerParentStatus with the most severe WorkerParentState (i.e. highest Ordinal) will be the main status returned. If set to true, the current instance will be the main status returned.

    In both cases, InnerStatuses is possibly extended with additional entries.

    WorkerParentStatus secondStatus

    The second status.

    Returns
    Type Description
    WorkerParentStatus

    The combined WorkerParentStatus.

    Remarks

    Supplementary properties Category, Exception, and Message are only allowed for states Canceled, Error, and Fatal.

    The WorkerParentStatus properties are immutable, i.e. they can't themselves be modified after construction. Note however that any Exception object in the Exception property is a mutable reference type, and its properties can be modified. To avoid any issues with this, never modify the Exception object in an WorkerParentStatus instance that have been returned from this Combine method.

    Error(String)

    Creates an Error status instance.

    Declaration
    public static WorkerParentStatus Error(string category)
    Parameters
    Type Name Description
    String category

    The category. Defaults to "Unset" if null.

    Returns
    Type Description
    WorkerParentStatus

    The Error status instance.

    Error(String, Exception)

    Creates an Error status instance.

    Declaration
    public static WorkerParentStatus Error(string category, Exception exception)
    Parameters
    Type Name Description
    String category

    The category. Defaults to "Unset" if null.

    Exception exception

    The exception. Can be null.

    Returns
    Type Description
    WorkerParentStatus

    The Error status instance.

    Error(String, Exception, String)

    Creates an Error status instance.

    Declaration
    public static WorkerParentStatus Error(string category, Exception exception, string message)
    Parameters
    Type Name Description
    String category

    The category. Defaults to "Unset" if null.

    Exception exception

    The exception. Can be null.

    String message

    The message. Defaults to an empty string if null.

    Returns
    Type Description
    WorkerParentStatus

    The Error status instance.

    Error(String, String)

    Creates an Error status instance.

    Declaration
    public static WorkerParentStatus Error(string category, string message)
    Parameters
    Type Name Description
    String category

    The category. Defaults to "Unset" if null.

    String message

    The message. Defaults to an empty string if null.

    Returns
    Type Description
    WorkerParentStatus

    The Error status instance.

    Failure(WorkerParentState, String)

    Creates a failure status instance.

    Declaration
    public static WorkerParentStatus Failure(WorkerParentState state, string category)
    Parameters
    Type Name Description
    WorkerParentState state

    The failure state, i.e. Canceled, Error, or Fatal.

    String category

    The category. Defaults to "Unset" if null.

    Returns
    Type Description
    WorkerParentStatus

    The failure status instance.

    Failure(WorkerParentState, String, Exception)

    Creates a failure status instance.

    Declaration
    public static WorkerParentStatus Failure(WorkerParentState state, string category, Exception exception)
    Parameters
    Type Name Description
    WorkerParentState state

    The failure state, i.e. Canceled, Error, or Fatal.

    String category

    The category. Defaults to "Unset" if null.

    Exception exception

    The exception. Can be null.

    Returns
    Type Description
    WorkerParentStatus

    The failure status instance.

    Failure(WorkerParentState, String, Exception, String)

    Creates a failure status instance.

    Declaration
    public static WorkerParentStatus Failure(WorkerParentState state, string category, Exception exception, string message)
    Parameters
    Type Name Description
    WorkerParentState state

    The failure state, i.e. Canceled, Error, or Fatal.

    String category

    The category. Defaults to "Unset" if null.

    Exception exception

    The exception. Can be null.

    String message

    The message. Defaults to an empty string if null.

    Returns
    Type Description
    WorkerParentStatus

    The failure status instance.

    Failure(WorkerParentState, String, String)

    Creates a failure status instance.

    Declaration
    public static WorkerParentStatus Failure(WorkerParentState state, string category, string message)
    Parameters
    Type Name Description
    WorkerParentState state

    The failure state, i.e. Canceled, Error, or Fatal.

    String category

    The category. Defaults to "Unset" if null.

    String message

    The message. Defaults to an empty string if null.

    Returns
    Type Description
    WorkerParentStatus

    The failure status instance.

    Fatal(String)

    Creates a Fatal status instance.

    Declaration
    public static WorkerParentStatus Fatal(string category)
    Parameters
    Type Name Description
    String category

    The category. Defaults to "Unset" if null.

    Returns
    Type Description
    WorkerParentStatus

    The Fatal status instance.

    Fatal(String, Exception)

    Creates a Fatal status instance.

    Declaration
    public static WorkerParentStatus Fatal(string category, Exception exception)
    Parameters
    Type Name Description
    String category

    The category. Defaults to "Unset" if null.

    Exception exception

    The exception. Can be null.

    Returns
    Type Description
    WorkerParentStatus

    The Fatal status instance.

    Fatal(String, Exception, String)

    Creates a Fatal status instance.

    Declaration
    public static WorkerParentStatus Fatal(string category, Exception exception, string message)
    Parameters
    Type Name Description
    String category

    The category. Defaults to "Unset" if null.

    Exception exception

    The exception. Can be null.

    String message

    The message. Defaults to an empty string if null.

    Returns
    Type Description
    WorkerParentStatus

    The Fatal status instance.

    Fatal(String, String)

    Creates a Fatal status instance.

    Declaration
    public static WorkerParentStatus Fatal(string category, string message)
    Parameters
    Type Name Description
    String category

    The category. Defaults to "Unset" if null.

    String message

    The message. Defaults to an empty string if null.

    Returns
    Type Description
    WorkerParentStatus

    The Fatal status instance.

    ThrowOnFailure()

    Throws an InvalidOperationException if the State is a failure state.

    Declaration
    public void ThrowOnFailure()
    Exceptions
    Type Condition
    InvalidOperationException

    State

    ToLongString()

    Returns a String that describes this instance in detail.

    Declaration
    public string ToLongString()
    Returns
    Type Description
    String

    ToOutcomeStatus(Boolean)

    Creates an OutcomeStatus instance from this WorkerParentStatus instance.

    Declaration
    public OutcomeStatus ToOutcomeStatus(bool notCompletedIsSucceeded)
    Parameters
    Type Name Description
    Boolean notCompletedIsSucceeded

    If set to true, will silently convert not completed states to the Succeeded state. If set to false, will throw an exception on any not completed states.

    Returns
    Type Description
    OutcomeStatus

    The OutcomeStatus instance.

    Exceptions
    Type Condition
    InvalidCastException

    Cannot convert an uncompleted state to OutcomeStatus.

    ToOutcomeStatusTask(Boolean)

    Creates an OutcomeStatus instance wrapped in a Task from this WorkerParentStatus instance.

    Declaration
    public Task<OutcomeStatus> ToOutcomeStatusTask(bool notCompletedIsSucceeded)
    Parameters
    Type Name Description
    Boolean notCompletedIsSucceeded

    If set to true, will silently convert not completed states to the Succeeded state. If set to false, will throw an exception on any not completed states.

    Returns
    Type Description
    Task<OutcomeStatus>

    The Task{OutcomeStatus} instance.

    Exceptions
    Type Condition
    InvalidCastException

    Cannot convert an uncompleted state to OutcomeStatus.

    ToString()

    Returns a String that represents this instance.

    Declaration
    public sealed override string ToString()
    Returns
    Type Description
    String
    Overrides
    Object.ToString()

    ToTask()

    Returns a task with the status instance in the Task.Result property.

    Declaration
    public Task<WorkerParentStatus> ToTask()
    Returns
    Type Description
    Task<WorkerParentStatus>

    Implements

    IOutcomeStatus
    In This Article
    Back to top Copyright © 2023 Envobi Ltd