All Projects → yiyungent → PluginCore

yiyungent / PluginCore

Licence: other
ASP.NET Core lightweight plugin framework. ASP.NET Core 轻量级 插件框架 - 一分钟集成

Programming Languages

C#
18002 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to PluginCore

Voyager
Alternative routing system for aspnet api applications.
Stars: ✭ 44 (-65.35%)
Mutual labels:  asp-net-core
SQLiteEncryptionUsingEFCore
SQLite Encryption using Entity Framework Core (EFCore)
Stars: ✭ 42 (-66.93%)
Mutual labels:  asp-net-core
StormReport
🌀 Library - Create your reports using only annotations
Stars: ✭ 17 (-86.61%)
Mutual labels:  asp-net-core
RDO.Net
Relational Data Objects for .Net
Stars: ✭ 23 (-81.89%)
Mutual labels:  asp-net-core
smartadmin.core.urf
Domain Driven Design (DDD) lightweight development architecture(support .net 5.0)
Stars: ✭ 100 (-21.26%)
Mutual labels:  asp-net-core
LearningPoint
A repository for learning different technologies, frameworks, features......
Stars: ✭ 66 (-48.03%)
Mutual labels:  asp-net-core
IdentityServer4.PhoneNumberAuth
Sample passwordless phone number authentication using OAuth in ASP.NET Core 2.2
Stars: ✭ 83 (-34.65%)
Mutual labels:  asp-net-core
ASP.NET-CORE-MVC-Sample-Registration-Login
C# Asp.Net Core MVC Sample Registration/Login/Email Activation Form with MsSQL Server/Entity Framework/Onion Architecture
Stars: ✭ 37 (-70.87%)
Mutual labels:  asp-net-core
Sitko.Core
Sitko.Core is a set of libraries to help build .NET Core applications fast
Stars: ✭ 46 (-63.78%)
Mutual labels:  asp-net-core
JwtAuthDemo
ASP.NET Core + Angular JWT auth demo; integration tests; login, logout, refresh token, impersonation, authentication, authorization; run on Docker Compose.
Stars: ✭ 278 (+118.9%)
Mutual labels:  asp-net-core
ProblemDetailsDemo
Example ASP.Net Core Web API that conforms to the Problem Details spec
Stars: ✭ 27 (-78.74%)
Mutual labels:  asp-net-core
eixample
Multi-Tenant .NET 6 Architecture (Angular, Vue, React)
Stars: ✭ 61 (-51.97%)
Mutual labels:  asp-net-core
ForEvolve.AspNetCore.Localization
Easy Asp.Net Core MVC validation data attributes localization.
Stars: ✭ 17 (-86.61%)
Mutual labels:  asp-net-core
CleanArchitectureDemo
This is a demo project built on .NET Core 3.1 Clean Architecture. Please refer the articles mentioned in the readme to learn more.
Stars: ✭ 33 (-74.02%)
Mutual labels:  asp-net-core
auth0documentdb
Sample repository for Auth0 & Azure DocumentDB integration
Stars: ✭ 14 (-88.98%)
Mutual labels:  asp-net-core
Demo.AspNetCore.ServerSentEvents
Demo project for demonstrating functionality of Lib.AspNetCore.ServerSentEvents
Stars: ✭ 52 (-59.06%)
Mutual labels:  asp-net-core
CVPZ
No description or website provided.
Stars: ✭ 16 (-87.4%)
Mutual labels:  asp-net-core
Something-about-aspnetcore-book
The Something about ASP.NET Core Book is introduction to web programming and based on ASP.NET Core 2.2
Stars: ✭ 35 (-72.44%)
Mutual labels:  asp-net-core
Dynamic-User-Defined-Dashboards-Asp-Net-Core
Complete Solution for Dynamically Created User-Defined Dashboards using Asp.Net Core
Stars: ✭ 32 (-74.8%)
Mutual labels:  asp-net-core
CleanArchitecture-Template
This is a solution template for Clean Architecture and CQRS implementation with ASP.NET Core.
Stars: ✭ 60 (-52.76%)
Mutual labels:  asp-net-core

PluginCore

PluginCore

English | 中文

ASP.NET Core lightweight plugin framework

repo size LICENSE CodeFactor downloads QQ Group Telegram Group hits

Introduce

ASP.NET Core lightweight plugin framework

  • Simple - Agreement is better than configuration, with minimal configuration to help you focus on your business
  • Out of the box - Automatic front-end and back-end integration, two lines of code complete the integration
  • Dynamic WebAPI - Each plug-in can add a Controller and have its own routing
  • Front and back ends of the plug-in are separated - You can place the front-end files (index.html,...) under the plugin wwwroot folder, and then visit /plugins/pluginId/index.html
  • Hot swap - Upload, install, enable, disable, uninstall, and delete without restarting the site; you can even add the HTTP request pipeline middleware at runtime through the plug-in, and there is no need to restart the site
  • Dependency injection - You can apply for dependency injection in the construction method of the plug-in class that implements IPlugin. Of course, dependency injection can also be used in the controller construction method
  • Easy to expand - You can write your own plug-in SDK, then reference the plug-in SDK, write extension plug-ins-custom plug-in hooks, and apply
  • Widget - You can bury the extension point in the front end, and then insert the widget through the plugin
  • No database required - No database dependency
  • 0 intrusion - Nearly zero intrusion, does not affect your existing system
  • Little reliance - Only rely on a third-party package (SharpZipLib for decompression)

Online demo

  • http://plugincore.moeci.com/PluginCore/Admin
    • Username: admin Password: ABC12345
    • Online demo, most of the functions are limited, complete experience, please build it yourself, you can use the Docker below to quickly experience
    • Not the latest version

Screenshot

One minute integration

Recommended Use NuGet, Execute the following commands in the root directory of your project. If you use Visual Studio, then click Tools -> NuGet Package Manager -> Package Manager Console, make sure "Default project" It is the item you want to install, enter the command below to install it.

ASP.NET Core Project

PM> Install-Package PluginCore.AspNetCore

Modify the code in your ASP.NET Core application

Startup.cs

using PluginCore.AspNetCore.Extensions;

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
    services.AddControllers();

    // 1. Add PluginCore
    services.AddPluginCore();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
    }

    app.UseHttpsRedirection();

    app.UseRouting();

    // 2. Use PluginCore
    app.UsePluginCore();

    app.UseAuthorization();

    app.UseEndpoints(endpoints =>
    {
        endpoints.MapControllers();
    });
}

Now visit https://localhost:5001/PluginCore/Admin to enter PluginCore Admin https://localhost:5001 Need to be changed to your address

Notice

Please log in to PluginCore Admin, and for safety, modify the default user name and password in time:

App_Data/PluginCore.Config.json

{
	"Admin": {
		"UserName": "admin",
		"Password": "ABC12345"
	},
	"FrontendMode": "LocalEmbedded",
	"RemoteFrontend": "https://cdn.jsdelivr.net/gh/yiyungent/[email protected]/dist-cdn"
}

After the modification, it will take effect immediately, no need to restart the site, you need to log in to PluginCore Admin again

Docker experience

If you need to experience PluginCore locally, then here is an example(/examples)

docker run -d -p 5004:80 -e ASPNETCORE_URLS="http://*:80" --name plugincore-aspnetcore3-1 yiyungent/plugincore-aspnetcore3-1

Now you can visit http://localhost:5004/PluginCore/Admin

add:
If you use Docker Compose, you can refer to docker-compose.yml in the root directory of the warehouse

add:
Use ghcr.io

docker run -d -p 5004:80 -e ASPNETCORE_URLS="http://*:80" --name plugincore-aspnetcore3-1 ghcr.io/yiyungent/plugincore-aspnetcore3-1

Use

Add plugin hook and apply

  1. For example, custom plug-in hook: ITestPlugin
using PluginCore.IPlugins;

namespace PluginCore.IPlugins
{
    public interface ITestPlugin : IPlugin
    {
        string Say();
    }
}
  1. Apply the hook where it needs to be activated, so that all enabled plug-ins that implement ITestPlugin will call Say()
using PluginCore;
using PluginCore.IPlugins;

namespace WebApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class TestController : ControllerBase
    {
        private readonly PluginFinder _pluginFinder;

        public TestController(PluginFinder pluginFinder)
        {
            _pluginFinder = pluginFinder;
        }

        public ActionResult Get()
        {
            //var plugins = PluginFinder.EnablePlugins<BasePlugin>().ToList();
            // All enabled plugins that implement ITestPlugin
            var plugins2 = _pluginFinder.EnablePlugins<ITestPlugin>().ToList();

            foreach (var item in plugins2)
            {
                // transfer
                string words = item.Say();
                Console.WriteLine(words);
            }

            return Ok("");
        }
    }
}

Custom frontend

PluginCore supports 3 front-end file loading methods

FrontendMode in the configuration file App_Data/PluginCore.Config.json

  1. LocalEmbedded
  • By default, embedded resources and front-end files are packaged into dll. In this mode, it is not easy to customize the front-end files. You need to modify the source code of PluginCore and recompile. It is not recommended
  1. LocalFolder
  • In the ASP.NET Core project that integrates PluginCore, create a new PluginCoreAdmin, and put the front-end files into this folder
  1. RemoteCDN
  • To use remote CDN resources, you can specify the url through the RemoteFrontend in the configuration file

注意:
更新 FrontendMode, 需重启站点后, 才能生效

补充

补充

开发插件只需要, 添加对 PluginCore.IPlugins 包 (插件sdk) 的引用即可,

当然如果你需要 PluginCore , 也可以添加引用

规范

  1. 插件sdk

插件接口应当位于 PluginCore.IPlugins 命名空间,这是规范,不强求,但建议这么做,

程序集名不一定要与命名空间名相同,你完全在你的插件sdk程序集中,使用 PluginCore.IPlugins 命名空间。

  1. 插件

插件程序集名(一般=项目(Project)名) 与 插件 info.jsonPluginId 一致, 例如: Project: HelloWorldPlugin, PluginId: HelloWorldPlugin, 此项必须,否则插件无法加载 PluginId 为插件唯一标识

版本依赖

PluginCore.IPlugins-v0.8.0 起, PluginCore 项目重构, PluginCore 只包含核心插件逻辑, ASP.NET Core 需要使用 PluginCore.AspNetCore

PluginCore.IPlugins 0.8.0 0.8.0 0.8.0 0.8.0 0.8.0 0.8.0 0.8.0 0.8.0
PluginCore 1.0.0 1.0.0 1.0.0 1.0.0 2.0.0 2.0.0 2.0.1 2.0.1
PluginCore.IPlugins.AspNetCore 0.0.1 0.0.1 0.0.1 0.0.1 0.0.1 0.0.1 0.0.1 0.0.1
PluginCore.AspNetCore 0.0.2 0.0.3 0.0.4 0.0.5 0.0.5 1.0.0 1.0.1 1.0.2
plugincore-admin-frontend 0.1.0 - 0.3.1 0.1.0 - 0.3.1 0.1.0 - 0.3.1 0.1.0 - 0.3.1 0.1.0 - 0.3.1 0.1.0 - 0.3.1 0.1.0 - 0.3.1 0.3.2
plugincore-js-sdk 0.1.0 - 0.5.0 0.1.0 - 0.5.0 0.1.0 - 0.5.0 0.1.0 - 0.5.0 0.1.0 - 0.5.0 0.1.0 - 0.5.0 0.1.0 - 0.5.0 0.1.0 - 0.5.0

下方为旧版依赖, 仅作存档

PluginCore.IPlugins 0.1.0 0.1.0 0.2.0 0.2.0 0.2.0 0.3.0 0.3.0 0.4.0 0.5.0 0.6.0 0.6.0 0.6.0 0.6.0 0.6.1 0.6.1 0.6.1 0.7.0 0.7.0 0.7.0 0.7.0
PluginCore 0.1.0 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.5.1 0.6.0 0.7.0 0.8.0 0.8.1 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.9.0 0.9.1 0.9.2 0.9.3
plugincore-admin-frontend 0.1.0 0.1.2 0.1.2 0.1.3 0.1.3 0.2.0 0.2.0 0.2.0 0.2.0 0.2.0 0.2.3 0.2.3 0.2.3 0.2.3 0.3.0 0.3.0 0.3.0 0.3.0 0.3.0 0.3.1
plugincore-js-sdk - - - - - - - - - - - - - - - - 0.1.0 0.1.0 0.1.0 0.1.0
PluginCore.IPlugins nuget downloads
PluginCore nuget downloads
PluginCore.IPlugins.AspNetCore nuget downloads
PluginCore.AspNetCore nuget downloads
PluginCore.Template nuget downloads

环境

  • 运行环境: .NET Core 3.1 (+)
  • 开发环境: Visual Studio Community 2019

相关项目

赞助者

TODO:

鸣谢

  • 插件系统设计参考自 CoolCat,感谢作者 lamondlu 的贡献
  • 设计参考自 nopCommerce,感谢作者 nopSolutions 的贡献

Donate

PluginCore is an Apache-2.0 licensed open source project and completely free to use. However, the amount of effort needed to maintain and develop new features for the project is not sustainable without proper financial backing.

We accept donations through these channels:

Author

PluginCore © yiyun, Released under the Apache-2.0 License.
Authored and maintained by yiyun with help from contributors (list).

GitHub @yiyungent Gitee @yiyungent

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].