StrangeIoC
0.6.0
The IoC/Binding Framework for Unity3D and C#
|
Commands are where you place your business logic. More...
Public Member Functions | |
virtual void | Execute () |
Override this! Execute() is where you place the logic for your Command. | |
virtual void | Retain () |
Keeps the Command in memory. Use only in conjunction with Release() | |
virtual void | Release () |
Allows a previous Retained Command to be disposed. | |
virtual void | Restore () |
Use/override this method to clean up the Command for recycling. | |
virtual 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 | |
ICommandBinder | commandBinder [get, set] |
Back reference to the CommandBinder that instantiated this Commmand. | |
IInjectionBinder | injectionBinder [get, set] |
The InjectionBinder for this Context. | |
object | data [get, set] |
bool | cancelled [get, set] |
bool | IsClean [get, set] |
int | sequenceId [get, set] |
bool | retain [get, set] |
Properties inherited from strange.extensions.command.api.ICommand | |
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] |
Properties inherited from strange.extensions.pool.api.IPoolable | |
bool | retain [get] |
Is this instance retained? More... | |
Commands are where you place your business logic.
In the MVCSContext 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.