First Backend plugin (preview)

Creating a plugin based on a template

We will now develop a basic backend plugin for publishing to the preview MEF.DEV platform. To develop this plugin, you only need knowledge of writing code in the C# language

Follow the instructions and learn how to create your first plugin that will share your data or business logic with other developers.

Make a copy of the test project from the repository

// lynk

Step 1. Create new project

Open project into Visual Studio, add into Sources the NuGet server below

// NuGet server lynk

You will have access to packages available for use on the platform

Step 2. Restoring packages for a new project

The structure of the platform is free, the main thing is to adhere to the rules for defining attributes for classes of plugins and entities

To continue working, you need to restore the packages for the downloaded project, if the project is created from scratch - add the UCP.Common.Plugin package to the project - this package acts as a contract for your business logic or data plugin

Step 3. Making changes to the project

The unique identifier on the platform is the name of the project, as well as the name of the entity - therefore we will rename the project and change the name of the entity

Define a unique Export and ModuleName that matches the project name

If there is a need to store data for the specified entity, you must inherit the BaseEntity class for all classes that will be passed to or received from the plugin

The name of the exported class (contractName) for working with the entity via POST for the plugin must match the name of the plugin. Names of entities for receiving data must inherit BaseEntity, but the name of contractName can be arbitrary. After the changes have been made, you can collect the archive for uploading to the platform. It is important that the archive contains the project dependencies - the easiest way is to call the command from the dotnet publish console and put all the contents of the folder in a zip archive.

Plugin registration on the platform

To do this, you must be a registered user of the platform with the Developer or Root role - if you are not registered, then during the first login to the platform by the lynk you will be given the opportunity to register

Step 4. Upload plugin

Go to the list of your plugins, click create a new plugin

Fill out the form with the information below - first define the API type for the plugin

The name and descriptions, images of the plugin are arbitrary. After filling in the basic information, click the "Save" button, and then you can upload the prepared plugin to the platform

If the download was successful, the newly downloaded plugin will appear in the list of available versions.

Select the required version for use on the platform and click the "Save" button.

From this moment, the entities of your plugin become available for use - both for external (via API) and for internal (via reuse). We can check the upload result using any REST client.

Step 5. Checking the loaded plugin via REST client

A Basic Auth user credentials to access the API can be created in the Security section of your profile, where you can get by clicking on the user icon in the upper right corner and selecting the Profile menu item. After clicking on the Set password button, you can set the username and password for authorization Basic Auth

Versioning of plugin changes

When you need to update the plugin, you just need to make the necessary changes, change the version of the package and build the archive, as at the first upload, upload it to the platform and select the new version of the package from the drop-down list: