Git Product home page Git Product logo

pluginframework's Introduction

Plugin Framework Logo

Plugin Framework for .NET Core NuGet Version

With Plugin Framework for .NET Core, everything is a plugin! Plugin Framework is a plugin platform for .NET Core applications, including ASP.NET Core, Blazor, WPF, Windows Forms and Console apps. It is light-weight and easy to integrate and supports multiple different plugin catalogs, including .NET assemblies, Nuget packages and Roslyn scripts.

Main Features

Here are some of the main features of Plugin Framework:

  • Everything is a plugin! Deliver plugins as Nuget-packages, .NET assemblies, Roslyn scripts and more.
  • Easy integration into a new or an existing .NET Core application.
  • Automatic dependency management.
  • Handles platform specific runtime DLLs and native DLLs when using Nuget-packages.
  • MIT-licensed, commercial support available.

Quickstart: Plugin Framework & ASP.NET Core

Plugin Framework is available from Nuget as a .NET Core 3.1 package. There's a separate package which makes it easier to work with plugins in an ASP.NET Core app:

NuGet Version

Install-Package Weikio.PluginFramework.AspNetCore

Using Plugin Framework can be as easy as adding a single new line into ConfigureServices:

services.AddPluginFramework<IOperator>(@".\myplugins");

The code finds all the plugins (types that implement the custom IOperator-interface) from the myplugins-folder. The plugins can be used in a controller using constructor injection:

public CalculatorController(IEnumerable<IOperator> operator)
{
	_operators = operators;
}

Alternatively, you can provide multiple plugin locations using catalogs:

var folderPluginCatalog = new FolderPluginCatalog(@".\myplugins", type =>
{
    type.Implements<IOperator>();
});

var anotherPluginCatalog = new FolderPluginCatalog(@".\morePlugins", type =>
{
    type.Implements<IOperator>();
});

services.AddPluginFramework()
    .AddPluginCatalog(folderPluginCatalog)
    .AddPluginCatalog(anotherPluginCatalog)
    .AddPluginType<IOperator>();

Samples

The following Plugin Framework samples are available from GitHub:

Plugin Framework & .NET Console Application

Plugin Framework & ASP.NET Core

Plugin Framework & Blazor

Plugin Framework & WPF App

Plugin Framework & WinForms App

Nuget & Plugin Framework & ASP.NET Core

Roslyn & Plugin Framework & ASP.NET Core

Delegates & Plugin Framework & ASP.NET Core

Tagging & WinForms App

AppSettings.json & ASP.NET Core

Background and introduction

For more details related to Plugin Framework's background, please see the following introduction article from InfoQ.

Main concepts

Using Plugin Framework concentrates around two concepts: Plugins and Plugin Catalogs.

Plugin

Plugins are software programs, which provide extensions to an application. Plugins are designed to work with a single application. This app is often called the host application. The host application is designed in such a way that it can locate and run plugins dynamically, runtime. The application works without the plugins, the plugins can't work without the host application.

The host application defines the specifications for the plugins. In some applications a plugin can add new functionality into the UI. In other apps, plugins are used to distribute logs into multiple different systems. The host application defines what kind of extensions it supports.

Plugin-based software architecture can help in the following scenarios:

  • Adding new features to application after the release
  • Splitting large systems into smaller parts
  • Updating always-on software system without restarting it

Plugins are dynamic, and they are often only loaded when the application needs them. Plugins are not usually compiled as part of the system but distributed as separate packages (assemblies, Nuget packages).

In the context of the Plugin Framework, plugin is a single .NET Type. What makes a plugin? As described previously, it depends on the host application. For some applications a plugin is a type which implements a specific interface. In some applications a plugin is a type which has a single public method called Run. Attributes are often used to indicate the plugins and that is also supported by Plugin Framework. From the Plugin Framework's point of view anything or everything can be a plugin.

As mentioned, in Plugin Framework a single plugin is a .NET Type. Even though Plugin Framework's ASP.NET Core support makes it easy to instantiate and use plugins in services and controllers through dependency injection (IServiceProvider), Plugin Framework itself doesn't provide any built-in mechanisms for creating instances (objects) from the plugins (types). In some cases Activator.CreateInstance is all that is needed and in some cases it is best to hook Plugin Framework with the app's DI-system. The requirements are host application specific.

In Plugin Framework, each Plugin is composed of the following information:

  • Type
  • Plugin name
  • Plugin version

Plugin Catalogs

Plugin Framework contains a concept called "Catalog". A single assembly can be a catalog. A .NET type can be a catalog. Folders with dlls are often used as catalogs and Plugin Framework also supports Nuget packages, Nuget feeds and Roslyn scripts as Plugin catalogs. Multiple catalogs are often combined into a single Composite catalog.

Each catalog contains 0-n plugins.

Plugin Framework provides the following officially supported catalogs:

Source code

Source code for Plugin Framework is available from GitHub.

Constributors

@panoukos41

Support

Commercial support for Plugin Framework is provided by Adafy.

Adafy Logo

Adafy is a Finnish software development house, focusing on Microsoft technologies.

License

Plugin Framework is available as an open source, MIT-licensed project.

pluginframework's People

Contributors

mikkou-adafy avatar mikoskinen avatar panoukos41 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.