Creating an AddIn in the LemonEdge Platform
This article explains how you can create a .net dll that can be imported into the LemonEdge platform using our AddIn Module technology.
You can create the code for your dll in any valid .net language, or import code that has been automatically generated (in c#) from our Auto Code Designers.
Tip
This article assumes you are familiar with the following LemonEdge concepts:
- AddIn Modules: How our AddIn technology works.
- Installing: How to take an AddIn and load it into your LemonEdge system
- Auto Code Designers: If you want to build this using our designers and download the code from the designer instead of writing it from scratch
- Walkthrough: Our guide explaining step by step how to create these entities using our designers
Note
You can follow along with this article by downloading the API Examples projects which provide the code examples discussed here.
All LemonEdge AddIns must be written in libraries targeting .net5.0.
Library types
LemonEdge has 2 main types of libraries that are loaded as AddIns in the platform. These are:
- Core: These dlls are loaded by every LemonEdge application, with the intention that they contain core classes, and algorithms that should be accessible everywhere:
- Client Applications (including Web browser)
- Web Service
- Task Service
- UI: These dlls are only loaded by the LemonEdge client applications only, with the intention they contain UI only logic that is not required by any back-end service:
- Full Windows Desktop
- Admin Console
- Core Application
- Web Browser App
Caution
There is also the possibility of creating a 3rd type of UI dll that specifically targets a particular client platform. For instance you can create a .net 5.0 WPF dll that holds WPF components for a view that can only be loaded within the Full Windows Desktop application. You would need to create similar dlls for each client application if you would want that view to work consistently across all LemonEdge platforms. Wherever possible it is better to stick with working within our UI API to ensure you views work across all applications without requiring specifically targeted dlls.
Creating a Core Library
To create a new library for LemonEdge, you can use your favourite editor (for example: Visual Studio or VS Code), to simply create a new .net library with a target framework of .net5.0.
If using c#, the project file should look like the following:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>
To utilise the API within LemonEdge you need your new library to reference the following two dlls:
- Utils.dll: Contains common helper functions used throughout the platform.
- API.dll: Contains all the core API classes and interfaces that can be used to interact with all elements of the LemonEdge platform.
These DLLs are included as part of your LemonEdge installation, and are fully supported and documented through our API Documentation.
Once referenced, your project file should look something like the following:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Reference Include="API">
<HintPath>LemonEdge\API.dll</HintPath>
</Reference>
<Reference Include="Utils">
<HintPath>LemonEdge\Utils.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
You can see our Designing Entities walkthrough for the code you can write against this library for use in the LemonEdge platform. You can also copy/paste any code created from our Auto Code Designers into your library to further tweak, or expand, its functionality.
Creating a UI Library
A UI library must contain all the same setup as the Core Library above except it also references the following UI dll:
- ClientCore.dll
Your project file, should therefore resemble the following:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Reference Include="API">
<HintPath>LemonEdge\API.dll</HintPath>
</Reference>
<Reference Include="Utils">
<HintPath>LemonEdge\Utils.dll</HintPath>
</Reference>
<Reference Include="ClientCore">
<HintPath>LemonEdge\ClientCore.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
This dll is only present in the client LemonEdge applications. The web, and task services, will be unable to load any UI specific AddIns.
This allows you to create custom UI views, commands, and more through our UI API that will automatically work across all our LemonEdge client applications.
You can see our Designing UIs walkthrough for the code you can write against this library for use in the LemonEdge client applications. You can also copy/paste any code created from our Auto Code Designers into your library to further tweak, or expand, its functionality.
Creating a UI Client Specific Library
You can also create UI dll that specifically targets a framework so you have full control over the interface created for your view. This dll can only target an individual LemonEdge client application, and thus if you want the same view to be accessible throughout all our applications, you will need to create one for each client application.
The library itself is the same as the UI Library above, except you can also reference the UI specific libraries for that .net5.0 application type. For instance if targeting the full windows application specifically then it would need to reference the WPF libraries, if targeting our web application it would need to reference the blazor libraries.
Once you've referenced the specific libraries you need you can create your custom views specifically for that platform.