Implementing
Now that the design of the project is done, the next step is to implement it. You can find helpful information on preparing your IDE in development tools. This also includes the installation and setup of the Solution CLI which provides several features related to local development as well as testing service projects.
Introduction
The implementation of a low-code service project is focused on the usage of commands, services, events and operations. These are the main elements to add functional behavior to the project.
While working on a REST API you will implement mostly operations and maybe call domain services to process the incoming request. Depending on your project's design you may need to gather additional data from an integration service that will then be processed and enriched with other data by using a domain service.
There is also the option to create, edit and persist data or load data from the datastore by using factory commands or instance commands. This domain service could also publish an event whenever a request has been processed or data has been created/persisted.
To make proper use of these elements you need to understand when and how to use which of them to implement the desired behavior. Below is a description of each element, its intended use and scope of other elements it can call.
Functional overview
Factory command
creates an instance of a root entity and persists it in the data-store
inside a factory command, events can be published
inside a factory command's implementation, there is a function called
available()
. This is used to check the necessary pre-conditions of the command. If the function returnstrue
then the command will be executed, otherwise, the command will not be executed at all
Instance command
manipulates the values of one or more properties of an already existing instance of an entity
inside an instance command, events can be published
inside an instance command's implementation, there is a function called
available()
. This is used to check the necessary pre-conditions of the command. If the function returnstrue
then the command will be executed, otherwise, the command will not be executed at all
Domain service
can perform operations throughout different domain namespaces
inside a domain service, you can call factory commands, instance commands, domain services, and events
Events
they are published to indicate that some state has changed
an event that is successfully published will automatically execute the script of the agent that is bound to this event
Agents
when an event is triggered, then agents are automatically executed as consequence of the action that triggered the event
inside agents, you can call factory commands, instance commands, domain services and trigger events
Operations
can perform operations throughout different domain namespaces
inside operations, you can call factory commands, instance commands and domain services
Scope overview
Factory command | Instance command | Domain service | Events | Agents | Operation | |
---|---|---|---|---|---|---|
Factory command | o | |||||
Instance command | o | |||||
Domain service | o | o | o | o | ||
Events | o | |||||
Agents | o | o | o | o | ||
Operation | o | o | o |