Server Development

1. Initializing Server Development

OMNIA Platform Server development workspace hold the Entity Behaviours of a Tenant. To open it while locally running a Development Environment, open http://host.docker.internal:5000 on your Browser and access the Modeler page of the Tenant you want to debug in.

Click in the dropdown arrow right next to the “Build & deploy” option, check the options in the “Development Workspaces (VS Code)” section and select the “Open Server Development Workspace”.

A new Visual Studio Code window will now open.

As soon as you open the Server workspace for the first time, you may receive a notification in VS Code to install some extensions. We recommend you to do that to enable IntelliSense.

Another notification to restore code dependencies must also prompts in the first time running the workspace, having you to confirm it to avoid errors. This also happens after a Clean & Build.

2. Switching Tenant Model

With Server Development opened, you can switch to another model by following the steps in “Initializing Server Development” relatively the other desired Tenant.

This replaces all the code in the model that you opened with Visual Studio Code.

3. Change code and apply changes to Model

You can check every Entity Behaviour in the Server Workspace and change any code. Note that local changes only applies after saving the files.

Now to verify and test your changes, start a local server by pressing F5 or the "Run" button on the left panel.

To access your local application, navigate to http://host.docker.internal:5000 and open the Application section.

When you’re satisfied with the result, you can apply the code to the Tenant’s model using OMNIA CLI. For that, run the following code line in Powershell:

omnia-cli model apply --subscription [Subscription] --tenant [Tenant] --environment [Environment] --path [Path] --build

Change the Parameters inside “[ ]” with:

Parameter Description
Subscription (Optional) The name of the configured subscription. Optional if there’s only one subscription configured.
Tenant The code of the tenant to be downloaded
Environment (Optional) The tenant environment. If not inserted, PRD is assumed
Path (Optional) The path where the model will be downloaded to. If not inserted, the current path is assumed

Note the flag "--build", it ensures a new Tenant’s Build is created. If you don’t want a new build, you can execute the code without this flag, but be aware the code you send to the OMNIA Platform will remain in the Tenant’s Modeler as “changed”.

Example:

```
    omnia-cli model apply --subscription local --tenant mytenant --environment PRD
```

4. Debug

You can always locally debug any Entity Behaviour, and since you’re using Visual Studio Code it’s also possible to use breakpoints and IntelliSense that supports entity and platform properties and variables.