Extensions
Introduction
WebTSM Services Extensions are a way to add functionality without having to implement a stand-alone webservice yourself. They are simple, binaries (.dll) compiled for .NET 5 in which one or more classes reference the HAKOM.Framework.Services.Extensibility namespace from the HAKOM.Framework.Services nuget package and implement their own web-controller logic in a Class decorated with the WebTSMServiceExtension Attribute (See Building WebTSM Services Extensions for details).
Formatting, authentication (if required) and all these things are handled by the WebTSM Service installation.
These DLL files need to be placed in an "extensions" directory within the installation directory of the WebTSM Services.
Adding, modifying or removing extensions requires the service to be restarted.
You can check for installed extensions by calling
GET /extensions
Which returns a list of installed extensions.
{
"example": {
"Name": "HAKOM WebTSM Services Example Extension",
"Description": "For demonstrating the extensions feature",
"Version": "1.0.0"
}
}
This particular extension would then be available under
GET /extensions/example
How to Install Extensions in Docker Containers
Single dll File Extension
An existing extension, that consist of just one dll file, can be added to the HAKOM WebTSM Services by using the mount command:
docker container create --name webTSMContainer -p 8080:80 --dns 10.0.12.1 --mount "type=bind,source={Path to your extension.dll file},destination=/app/extensions/extension.dll" -h HAKOM webtsmservices:3.8.7.0
Extension Folder
The mount command also works for adding an entire folder to the HAKOM WebTSM Services:
docker container create --name webTSMContainer -p 8080:80 --dns 10.0.12.1 --mount "type=bind,source={Path to your extension folder},destination=/app/extensions" -h HAKOM webtsmservices:3.8.7.0
Extension Dependencies
Any dependencies an extension uses can be placed in one of the following locations:
- /app
- The root directory of your WebTSM Services
- /app/extensions
- The folder has to be created first if it does not exist.
After the dll files are placed in the respective folder, they can be added to the HAKOM WebTSM Services using the above mount command for single dll files.
In some cases it's possible to experience System.BadImageFormatException error messages. Dependency dll files leading to this error message have to be placed in the /app (root) folder in order to work.