Article Managing Dependencies

Grouping plugins can make setup and configuration of your project more manageable using IPluginGroup. This will allow you to organize and create multiple plugins and group them in the administration panel.

Why should I group plugins?

When creating a content type it may be necessary to add multiple integrations with core services such as IRateableContentType, ICommentableContentType and ILikeableContentType. By creating a Group Plugin these plugins will all be enabled simultaneously when the Group Plugin is enabled.

Creating a Group Plugin

The Group Plugin interface only has one property called Plugins. It returns a list of types to be grouped. In this sample there are three simple classes that implement IPlugin, these are grouped by the IPluginGroup interface.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telligent.Evolution.Extensibility.Version1;

namespace Samples
{
    public class MyGroupPlugin : IPluginGroup
    {
        public string Name
        {
            get { return "My Group Plugin"; }
        }

        public string Description
        {
            get { return "This plugin will demo how IPluginGroup works"; }
        }

        public void Initialize()
        {
            //No initialization required for IPluginGroup
        }

        public IEnumerable<Type> Plugins
        {
            get
            {
                return new[]
                {
                    typeof (MyPluginOne),
                    typeof (MyPluginTwo),
                    typeof (MyPluginThree)
                };
            }
        }
    }

    public class MyPluginOne : IPlugin
    {
        public string Name
        {
            get { return "Plugin One"; }
        }

        public string Description
        {
            get { return "Part 1 of 3 for test plugin group"; }
        }

        public void Initialize() { }
    }

    public class MyPluginTwo : IPlugin
    {
        public string Name
        {
            get { return "Plugin Two"; }
        }

        public string Description
        {
            get { return "Part 2 of 3 for test plugin group"; }
        }

        public void Initialize() { }
    }

    public class MyPluginThree : IPlugin
    {
        public string Name
        {
            get { return "Plugin Three"; }
        }

        public string Description
        {
            get { return "Part 3 of 3 for test plugin group"; }
        }

        public void Initialize() { }
    }
}

Here is how the Group Plugin is displayed in the UI.