How to develop plugin functionality in ASP.NET Core App

9/24/2020

Having developed a well working ASP.NET Core App (which runs in a Kubernetes Cluster), I have the offer to develop an additional functionality. This functionality should only be available for this customer. Not the other customers. So I was thinking if I could develop this functionality as a "Plugin" for my App.

But unfortunately I never did this before and googling it led to more confusion than clarification.

I mean, I can think about adding a function as separate DLL, which seems to be a common practice. But how do I tell my app, that having this plugin, it has to behave differently?

For example, my plugin will create a Button on the Main Site with an according clicking-method behind. How does my Code has to look like in the index.cshtml file and in the Controller and in the JavaScript file?

Hope you understand what I mean, if not, please ask right away. Thank you for the answers in advance.

-- xola
asp.net-core
asp.net-core-mvc
c#
kubernetes
plugins

1 Answer

9/25/2020

I can think about adding a function as separate DLL

If you'd like to implement and package a functioning part of a web application as a class library, you can try to build this modular functionality into a Razor class library (RCL) that can be packaged and reused in your main site.

For more information, you can refer to the following doc:

https://docs.microsoft.com/en-us/aspnet/core/razor-pages/ui-class?view=aspnetcore-3.1&tabs=visual-studio

-- Fei Han
Source: StackOverflow