I’d like to have various PlugIn .DLLs in a subdirectory below the ContentRoot, and to specify the names of the PlugIns to load at runtime in a .config file setting.
While I hope I can figure out how to do this from documentation, I thought it worthwhile to inquire if there is any existing SS doc, best practices, or links to outside documentation to accomplish this?
Below is my current code for loading PlugIns (in MyAppHost.Configure
), and the ToDo:
comments describe what I’d like to accomplish
// ToDo: Get the list of plugin names to install from the configuration settings (I've no problem with this)
// ToDo: Probe for assemblies that have a class that matches the name and implements IPlugIn (I can figure this out from MS documentation on probing for assemblies at runtime)
// ToDo: Load the matching assemblies into the runspace (I can figure this out from MS documentation on loading assemblies at runtime)
// ToDo: Security: ensure the assemblies being loaded matches some external registry of SHA codes to prove non-tamperable and authenticity (later, not needed in the near term)
// ToDo: Add each PlugIn to the SSAppHost (I am unsure where to start for this. Finding the entry point to new'ing the Plugin() in the loaded assembly, and then passing that instance to PlugIns.Add is going to require a learning curve)
// This is how I'm doing it today, all is hardcoded and the main program takes a dependency on each PlugIn. Thiss is what I'm aiming to replace.
// Create the list of PlugIns to load
var plugInList = new List<IPlugin>() {
new GUIServicesPlugin(),
new RealEstateServicesPlugin(),
new MinerServicesPlugin(),
new DiskAnalysisServicesPlugin(),
};
// Load each plugin here.
foreach (var pl in plugInList) {
Plugins.Add(pl);
}
Thanks!