Table of Contents

Interface IBreakableModel

Namespace
Artemis.Core
Assembly
Artemis.Core.dll

Represents a model that can have a broken state

public interface IBreakableModel

Properties

BrokenDisplayName

Gets the display name of this breakable model

string BrokenDisplayName { get; }

Property Value

string

BrokenState

Gets or sets the broken state of this breakable model, if null this model is not broken.

string? BrokenState { get; set; }

Property Value

string

BrokenStateException

Gets or sets the exception that caused the broken state

Exception? BrokenStateException { get; set; }

Property Value

Exception

Methods

ClearBrokenState(string)

Clears the broken state and exception if BrokenState equals .

void ClearBrokenState(string state)

Parameters

state string

GetBrokenHierarchy()

Returns a list containing all broken models, including self and any children

IEnumerable<IBreakableModel> GetBrokenHierarchy()

Returns

IEnumerable<IBreakableModel>

SetBrokenState(string, Exception?)

Sets the broken state to the provided state and optional exception.

void SetBrokenState(string state, Exception? exception)

Parameters

state string

The state to set the broken state to

exception Exception

The exception that caused the broken state

TryOrBreak(Action, string)

Try to execute the provided action. If the action succeeded the broken state is cleared if it matches , if the action throws an exception BrokenState and BrokenStateException are set accordingly.

bool TryOrBreak(Action action, string breakMessage)

Parameters

action Action

The action to attempt to execute

breakMessage string

The message to clear on succeed or set on failure (exception)

Returns

bool

true if the action succeeded; otherwise false.

Events

BrokenStateChanged

Occurs when the broken state of this model changes

event EventHandler BrokenStateChanged

Event Type

EventHandler