We make a CMS, and we want to make the possibility of plug-ins for it. For example: there is an article, and a plugin with which you can like the article. So, how to organize the plug-in project.

I understand how I can do embedding a plug-in action + view. You can do this: The plugin has a function, for example, AddLikestToArticle It has the attribute [PluginModule(ToAction: "ActionName", ToController: "ControllerName")] Then, when the plugin is connected, all functions with this attribute are registered in the system. At the time of the call to ActionName after it has already been faithful to HTML, the result of the result in the HTML DOM is this result and I call AddLikestToArticle apply it to the result.

But how to make a plugin for classes, and especially for classes that are stored in the database via EF . The plugin can extend classes (add columns to tables), or even add new classes. How to DbContext with DbContext , how to extend it with a plugin?

I am interested in all approaches that may be. Are there any ready-made systems for plug-in / modularity?

As long as I think it can be done. Extend classes through inheritance. In addition, each module can have its own class heir. The question remains how to build (as wide as possible) DbContext now. I think you can compile this file through code, that is, collect its code automatically and then compile it on-the-fly, and use it through IoC.

  • What kind of interface IExtesntions {object getExtenstions (); } and through DI to disassemble where necessary. Although a crutch decision. - QuaternioNoir
  • @QuaternioNoir and what is Dl? - Dmitry Polyanin
  • Depency Injection, for example, some kind of autofac. - QuaternioNoir
  • @QuaternioNoir something I can not find any documentation on IExtensions - Dmitry Polyanin
  • Oh, sorry) I meant to write my own interface for describing plugins. - QuaternioNoir

0