You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 20, 2025. It is now read-only.
public abstract class Export : ExporterBase
{
public virtual string InHere()
{
return string.Empty;
}
}
create PluginProject, create plugin class inherit from Export class above.
public class Import : Export
{
public override string InHere()
{
return "Lib1";
}
}
in main project, Create Runner class inherit from RunnerBase.
public class Runner : RunnerBase<Export>
{
public string DoSomething()
{
// Here you can access Exports which contain Dictionary of plugin class
// Tell our MEF parts to do something.
return string.Join(" ", Exports.Select(p => p.Value.InHere()));
}
}
in main program, Create runner by calling
var basePath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
var cachePath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "ShadowCopyCache");
var pluginPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "Plugins");
var runner = RunnerManager.CreateRunner<Runner, Export>(domainName, pluginPath, cachePath, basePath);
// Then you can call the plugin functions
var actual = runner.DoSomething();