I want to create an .net core app which can load plugins from a directory. The plugins need to implement a pluginbase interface so other people can write their own plugins. The pluginbase need a system for the plugins to have configuration options.
My program need to load the plugin options while not knowing what those options are since everyone can make their own plugins with their own options. The only thing my program need to do is get a list of all the options change them and give them back to the plugin.
my idea was to have all the plugin makers create an options class with properties in the form of name and value for each configuration item.
so far i have an interface pluginbase
public interface IPluginBase
{
IEnumerable<IPluginOption> Options { get; set; }
}
and an interface plugin option
public interface IPluginOption
{
public string Name { get; set; }
public string Value { get; set; }
}
what i cant figure out is the best way to make sure that they need to add an configuration class. I'm not sure that my property options in the pluginbase is right anyway.
I dont need recommendations about frameworks for plugins etc. I just like to know how you can make sure someone makes a class with those IPluginOptions in the same way you can make sure a class implements functions with interfaces.
Aucun commentaire:
Enregistrer un commentaire