Overview of Plugins
Plugins are .net-based classes implementing IPlugin. Plugins are used to interact with Telligent Evolution platform events, the in-process API, and services.
IPlugin is the base interface for all plugins. Additional, special-use plugin types extend IPlugin to provide access to use-case-specific functionality and provide a tighter integration with components of Telligent Evolution. For example, the IActivityStoryType plugin interface extends IPlugin to provide support for extending the Telligent Evolution activity stream.
The Plugin Manager both manages the lifecycle of plugins and provides access for retrieving instances of specific plugin types.
Getting started
Plugins are .net classes implementing one or more plugin interfaces. To create a new plugin:
- Create a new .net class library project in Visual Studio using .net 4.x.
- Add a reference to the Telligent Evolution assembly identified in the documentation associated to the plugin you want to implement. For example, to implement IPlugin, a reference to Telliget.Evolution.Components.dll is required.
- Create a new class in your class library project.
- Implement the plugin type. For example, the following class would implement IPlugin:
using System;
namespace MyPlugins
{
public class MyPlugin : Telligent.Evolution.Extensibility.Version1.IPlugin
{
}
}
Right-click the IPlugin reference in the code and select "Implement Interface" and Visual Studio will stub out the implementation of the plugin type. For example, the code above, once stubbed out, results in:
-
using System;
namespace MyPlugins
{
public class MyPlugin : Telligent.Evolution.Extensibility.Version1.IPlugin
{
#region IPlugin Members
public string Name
{
get { throw new NotImplementedException(); }
}
public string Description
{
get { throw new NotImplementedException(); }
}
public void Initialize()
{
throw new NotImplementedException();
}
#endregion
}
}
- Update the plugin's Name and Description. These properties are read to identify this plugin within the Control Panel.
- Implement the members defined by the plugin type. This is what defines what your plugin does. For example, it may attach an event handler to an event exposed by the In-process API and perform an action when that event occurs.
- Build the solution.
- Copy the resulting assembly (MyPlugins.dll for example) into the web/bin/ folder of your Telligent Evolution site.
- As an administrator, go to Control Panel > Administration > Site Administration > Site Configuration > Manage Plugins, find your plugin, check its associated box to enable the plugin, and save the changes.
- Your plugin is now running within Telligent Evolution.
Reference
View the Plugin API Documentation for more info on working with plugins and for a list of all core plugin types.
Best practices
There are a few best practices to keep in mind when developing plugins:
- Ensure that the plugin class is publicly accessible.
- Either don't define an explicit constructor or ensure that a parameterless contructor exists. The public, parameterless constructor is the one used by Telligent Evolution.
- Register event handlers within the Initialize() method only.
- Do not attach to any resources (database, file system, etc.) until the plugin's Initialize() method has been called.
- Feel free to implement more than one plugin interface with a single plugin class.
- Make use of other base plugin types when needed:
- IInstallablePlugin enables plugins to implement their own installation lifecycle with support for installation, upgrades, downgrades, and uninstallation.
- IConfigurablePlugin enables plugins to expose configuration on the Manage Plugins page of the Control Panel.
- IRequiredConfigurationPlugin ensures that a minimal amount of configuration information is provided by users before allowing the plugin to be enabled.
- IPluginGroup enables multiple dependent plugins to be enabled/disabled as a single unit.
- ITranslatablePlugin enables plugins to manage translatable text resources.
Information in this section
Plugin Lifecycle - The stages of use plugins go through, and when different types of plugins receive their translations, configurations, installation, destruction, and notifications are sent.