Services and components can run commands and operations through dependency injection.
Services and components can also register an implementation for any command or operation. Commands and operations can either be registered and implemented directly in a service or component, or registered in a class that extends
OperationsBase for ease of use by other components and services.
Multiple implementations can be registered for a Command or Operation.
Commands and operations can be directly registered and implemented in a service or component through the
This pattern can be useful for registering dynamically generated commands or implementations.
It is vital that subscription handles are cleaned up when the object is cleaned up, otherwise dangling references can occur. This can be done by implementing the
IDisposableTracker interface, and then providing
this as the second argument to a call to subscribe.
ComponentBase already implement these interfaces so you don't have to.
Commands and operations can also be defined in an
OperationsBase class, which can then be injected into any service or component that wants to register an implementation.
IVoidOperationproduces no output, and optionally takes an input.
IOperationproduces an output, and optionally takes an input.
Operation names in Geocortex Mobile generally take the format
<category>.<name>, with multiple words
These types can be used to define a set of operations in an
OperationsBase class that is registered with Autofac. Implementations for the operations can then be registered in a service or component.
- Custom Component
You can run the custom commands or operations you define by either injecting the appropriate
OperationsBase class or using the
IOperationRegistry to run the command or operation by name.
The Geocortex Mobile SDK Samples project has a sample of implementing a command with a custom service.