Extending
An introduction to extensibility in DynamicWeb 10.
DynamicWeb provides many ways to customize the platform, which can be broadly organized into two general categories:
- UI extensibility involves creating your own screens in the administration UI
- Functional extensibility involves hooking into e.g. system events and extending or changing how the system works without changing the UI
Here are the most commonly used functional extensibility points:
- Notification Subscribers allow you to hook up to events/notifications and execute custom code
- Providers and Configurable Add-Ins are used to create new integrations, e.g. custom payment processors or shipping services
- Services & Middleware are used for adding services into the ASP.NET Core services (dependency injection) and adding application wide middleware
- View
Models may be extended with custom properties to add non-standard information to your template contexts
Developing a custom add-in
DynamicWeb is a .NET application. In order to develop custom extensions, or add-ins, you need a working .NET capable development environment. No matter which type of extensibility you want to make, you will need to create a custom dll. Read more here about how to get your development environment setup.
Following the guide to get a DynamicWeb 10 installed locally will create a C# project for running the application. It is recommended to create a separate project for customizations. Whether a new project is created or the host project is used, this is a small Hello World
example of a notification subscriber that writes to the console when the application starts up.
//TODO: Add example here
Now run the application and notice the message appearing in the console.
After you have implemented the custom functionality, you are ready to create the custom add-in by building the project.
If everything builds you should have either a .dll
or a .nupkg
file, which contains your changes.
Now we need to get this functionality into DynamicWeb.
Installing add-ins
To install an add-in, you can use the Appstore.
You can also use local files, .dll or .nupkg, built and packaged locally or fetched manually through sites like NuGet or shared in other ways. Any file with the extension .dll
or .nupkg
located in the folder Files/System/Addins/Local
will be picked up as add-ins available to install. These add-ins can be installed through Settings > System > Developer > Addins > Local
.
It is also possible to use the Dynamicdw install
command. It works in the same way by uploading the file to the Local
folder and performing the installation.
Custom Add-ins
DynamicWeb 10 introduced a new paradigm for loading customizations compared with previous versions of DynamicWeb. Custom add-ins should no longer be added to the /bin
folder, rather they should be reside in the Files archive. DynamicWeb will load all the .dll
files located in /Files/System/Addins/Installed
.
Warning
While DynamicWeb will load custom add-ins located in the /bin
folder, it is not recommended to use this method.
Customizations added the /bin
folder cannot be managed by in the Administration, and they could possibly be removed or overwritten when a new version of the applications is deployed.
When any new add-in is installed into the solution, it will placed in a folder named by <Add-in Name>.<Add-in Version>
. Consider an add-in called DynamicwebExtensions with version 2.0.3, it will be placed in a folder called DynamicwebExtensions.2.0.3
under /Files/System/AddIns/Installed/
, full path: /Files/System/AddIns/Installed/DynamicwebExtensions.2.0.3
.