Creating a new plugin

Basic structure and principals

Creating a new plugin is a fairly straight forward process: For the purpose of this example, let's call our new plugin for customers plugin, to handle a list of customers, with a simple object structure. All plugins consist of a base nuget, which is going to contain database structure and constants.

Base nuget project

The base which is going to be a nuget, needs to follow this pattern:

  • A console application project called DBMigrator, with reference to the Microting.eFormBaseCustomerBase project.

  • A class library called the name of your base, eg.: Microting.eFormBaseCustomerBase

  • .travis.yml for testing, modify this to fit your base

  • upgradeeformnugets.sh for upgrading Microting.eFormApi.BasePn and Microting.eForm

The Microting.eFormBaseCustomerBase project needs to have the following folder structure:

See the basecustomer project for reference.

Keynotes to have in mind, is that every entity needs to enherit from the BaseEntity and they need to have a Versioned equivalent of the class. Each Entity needs to implement the following methods:

  • public async Task Create(CustomersPnDbAnySql dbContext)

  • public async Task Update(CustomersPnDbAnySql dbContext)

  • public async Task Delete(CustomersPnDbAnySql dbContext)

  • private CustomerVersion MapVersions(CustomersPnDbAnySql dbContext, Customer customer) ^ replace CustomerVersion and Customer customer with the respective class names for your entity.

This is to ensure that all entities used in the ecosystem conforms to the same standard. See https://github.com/microting/eform-basecustomer-base/blob/master/Microting.eFormBaseCustomerBase/Infrastructure/Data/Entities/Customer.cs for reference.

Plugin project

The repository needs to have the following folder structure/files.

See the customers project for reference.

Last updated

Was this helpful?