StateValidator

StockSharp.Messages

Unified state transition validator for all state enums.

Methods

IsActive
public static bool IsActive(OrderStates state)
result = StateValidator.IsActive(state)

Determines if the OrderStates is an active (working) state.

state
State to check.

Returns: true if state is active; otherwise false.

IsActive
public static bool IsActive(SubscriptionStates state)
result = StateValidator.IsActive(state)

Determines if the SubscriptionStates is an active (working) state.

state
State to check.

Returns: true if state is active; otherwise false.

IsActive
public static bool IsActive(ChannelStates state)
result = StateValidator.IsActive(state)

Determines if the ChannelStates is an active (working) state.

state
State to check.

Returns: true if state is active; otherwise false.

IsActive
public static bool IsActive(SessionStates state)
result = StateValidator.IsActive(state)

Determines if the SessionStates is an active (working) state.

state
State to check.

Returns: true if state is active; otherwise false.

IsStopped
public static bool IsStopped(ChannelStates state)
result = StateValidator.IsStopped(state)

Determines if the ChannelStates is a stopped state.

state
State to check.

Returns: true if state is stopped; otherwise false.

IsTerminal
public static bool IsTerminal(OrderStates state)
result = StateValidator.IsTerminal(state)

Determines if the OrderStates is a terminal (final) state.

state
State to check.

Returns: true if state is terminal; otherwise false.

IsTerminal
public static bool IsTerminal(SubscriptionStates state)
result = StateValidator.IsTerminal(state)

Determines if the SubscriptionStates is a terminal (final) state.

state
State to check.

Returns: true if state is terminal; otherwise false.

IsTerminal
public static bool IsTerminal(SessionStates state)
result = StateValidator.IsTerminal(state)

Determines if the SessionStates is a terminal (final) state.

state
State to check.

Returns: true if state is terminal; otherwise false.

IsValid
public static bool IsValid(OrderStates from, OrderStates to)
result = StateValidator.IsValid(from, to)

Check if transition from one OrderStates to another is valid.

from
Current state.
to
New state.

Returns: true if transition is valid; otherwise false.

IsValid
public static bool IsValid(ChannelStates from, ChannelStates to)
result = StateValidator.IsValid(from, to)

Check if transition from one ChannelStates to another is valid.

from
Current state.
to
New state.

Returns: true if transition is valid; otherwise false.

IsValid
public static bool IsValid(SubscriptionStates from, SubscriptionStates to)
result = StateValidator.IsValid(from, to)

Check if transition from one SubscriptionStates to another is valid.

from
Current state.
to
New state.

Returns: true if transition is valid; otherwise false.

IsValid
public static bool IsValid(SessionStates from, SessionStates to)
result = StateValidator.IsValid(from, to)

Check if transition from one SessionStates to another is valid.

from
Current state.
to
New state.

Returns: true if transition is valid; otherwise false.

Validate
public static bool Validate(OrderStates? from, OrderStates to, object context, ILogReceiver logs, bool throwOnInvalid)
result = StateValidator.Validate(from, to, context, logs, throwOnInvalid)

Validate OrderStates transition with logging and optional exception.

from
Current state (null means initial state).
to
New state.
context
Context for error message (e.g., transaction id).
logs
Log receiver for warnings.
throwOnInvalid
If true, throws InvalidOperationException on invalid transition.

Returns: true if transition is valid; otherwise false.

Validate
public static bool Validate(ChannelStates from, ChannelStates to, object context, ILogReceiver logs, bool throwOnInvalid)
result = StateValidator.Validate(from, to, context, logs, throwOnInvalid)

Validate ChannelStates transition with logging and optional exception.

from
Current state.
to
New state.
context
Context for error message.
logs
Log receiver for warnings.
throwOnInvalid
If true, throws InvalidOperationException on invalid transition.

Returns: true if transition is valid; otherwise false.

Validate
public static bool Validate(SubscriptionStates from, SubscriptionStates to, object context, ILogReceiver logs, bool throwOnInvalid)
result = StateValidator.Validate(from, to, context, logs, throwOnInvalid)

Validate SubscriptionStates transition with logging and optional exception.

from
Current state.
to
New state.
context
Context for error message (e.g., subscription id).
logs
Log receiver for warnings.
throwOnInvalid
If true, throws InvalidOperationException on invalid transition.

Returns: true if transition is valid; otherwise false.

Validate
public static bool Validate(SessionStates from, SessionStates to, object context, ILogReceiver logs, bool throwOnInvalid)
result = StateValidator.Validate(from, to, context, logs, throwOnInvalid)

Validate SessionStates transition with logging and optional exception.

from
Current state.
to
New state.
context
Context for error message.
logs
Log receiver for warnings.
throwOnInvalid
If true, throws InvalidOperationException on invalid transition.

Returns: true if transition is valid; otherwise false.