StrangeIoC
0.6.0
The IoC/Binding Framework for Unity3D and C#
|
Interface for Commands, which is where you place your business logic. More...
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] |
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.
|
getset |
The property set to true by a Cancel() call.
Use cancelled internally to determine if further execution is warranted, especially in asynchronous calls.
|
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.