Problem:
I am constructing a framework which accepts a file, translates it and executes it. The framework should be able to handle any type of file, to this end i have provided a method of uploading a DLL containing classes and methods for translating and executing a file. What i am looking for, is the best way to define the plugin interface
Solution A:
Define a set of interfaces which are publicly available. Plugins should implement these interfaces.
Solution B:
Define some abstract classes which are publicly available. Plugins should inherrit and override the abstract methods on these classes.
Solution C: rcravens
Pass interfaces around inside the code, create an abstract class which is publicly available to allow for plugin extensibility. Chosen
This solution was chosen ahead of interface only because it enables basic implementation (handy in this case). It was chosen ahead of abstract class only because it enables mocking within the code. The composition frameworks are excellent, but a bit over the top for something as lightweight as this application where only limited extensibility is desired.
Solution D: Jay and Chris Shain
Implement a composition framework (such as Managed Extensibility Framework(MEF)) and build around it
If any new solutions appear, i will add them to this list. The answer will go to the person who is best able to justify their solution (possibly with advantages and limitation)
Thanks in advance,
Tech Test Dude
In this paper, a plugin is code that can become part of a program under that program's control. For C and C++ programs plugins are typically implemented as shared libraries that are dynamically loaded (and sometimes unloaded) by the main program.
The plugin framework is a NuGet package that allows you to customise and extend a .NET application. Plugins are loaded at runtime from a catalogue which can be a local source or via NuGet. Supports all the current . NET Core based applications, ranging from Blazor to ASP.NET Core and to Console, WPF and Windows Forms.
plug-in, also called add-on or extension, computer software that adds new functions to a host program without altering the host program itself. Widely used in digital audio, video, and Web browsing, plug-ins enable programmers to update a host program while keeping the user within the program's environment.
What you are writing sounds suspiciously like what Managed Extensibility Framework supports: http://mef.codeplex.com/. Maybe just use that and avoid re-inventing the wheel?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With