StrangeIoC  0.6.0
The IoC/Binding Framework for Unity3D and C#
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public Member Functions | Properties | List of all members
strange.extensions.command.api.ICommand Interface Reference

Interface for Commands, which is where you place your business logic. More...

Inheritance diagram for strange.extensions.command.api.ICommand:
strange.extensions.command.impl.Command strange.extensions.sequencer.api.ISequenceCommand strange.extensions.command.impl.EventCommand strange.extensions.sequencer.impl.SequenceCommand strange.extensions.sequencer.impl.SequenceCommand strange.extensions.sequencer.impl.EventSequenceCommand strange.extensions.sequencer.impl.EventSequenceCommand

Public Member Functions

void Execute ()
 Override this! Execute() is where you place the logic for your Command.
 
void Retain ()
 Keeps the Command in memory. Use only in conjunction with Release()
 
void Release ()
 Allows a previous Retained Command to be disposed.
 
void Fail ()
 Inidcates that the Command failed Used in sequential command groups to terminate the sequence.
 
void Cancel ()
 Inform the Command that further Execution has been terminated.
 

Properties

bool IsClean [get, set]
 Flag to indicate that a pooled Command has been restored to its pristine state. More...
 
bool retain [get]
 The property set by Retain and Release to indicate whether the Command should be cleaned up on completion of the Execute() method.
 
bool cancelled [get, set]
 The property set to true by a Cancel() call. More...
 
object data [get, set]
 A payload injected into the Command. Most commonly, this an IEvent.
 
int sequenceId [get, set]
 

Detailed Description

Interface for Commands, which is where you place your business logic.

In the default StrangeIoC setup, commands are mapped to IEvents. The firing of a specific event on the global event bus triggers the instantiation, injection and execution of any Command(s) bound to that event.

By default, commands are cleaned up immediately on completion of the Execute() method. For asynchronous Commands (e.g., calling a service and awaiting a response), call Retain() at the top of your Execute() method, which will prevent premature cleanup. But remember, having done so it is your responsipility to call Release() once the Command is complete.

Calling Fail() will terminate any sequence in which the Command is operating, but has no effect on Commands operating in parallel.

Property Documentation

bool strange.extensions.command.api.ICommand.cancelled
getset

The property set to true by a Cancel() call.

Use cancelled internally to determine if further execution is warranted, especially in asynchronous calls.

bool strange.extensions.command.api.ICommand.IsClean
getset

Flag to indicate that a pooled Command has been restored to its pristine state.

The CommandBinder will use this to determine if re-Injection is required.


The documentation for this interface was generated from the following file: