Dobry den
Chcel by som Vas poprosit o radu ohladom pluginov v ASP.NET
Pomocou nizsie uvedeneho kodu si vytvorim a zaregistrujem instanciu pluginu v aplikacii (to funguje bezchybne) ale moj problem spociva v tom ze neviem ako dany plugin potom VYMAZAT / ODINSTALOVAT. Vedel by mi niekto prosim poradit?
public class PluginLoader
{
/// <summary>
/// Loads the plugins from current folder
/// [All files ending with Plugin.dll are supposed to have IPlugin implementations]
/// </summary>
/// <returns></returns>
public IList<IPlugin> LoadPlugins(string folder)
{
IList<IPlugin> plugins = new List<IPlugin>();
// Get files in folder
string[] files = Directory.GetFiles(folder, "*Plugin.dll");
foreach (string file in files)
{
Assembly assembly = Assembly.LoadFile(file);
var types = assembly.GetExportedTypes();
foreach (Type type in types)
if (type.GetInterfaces().Contains(typeof(IPlugin)))
{
object instance = Activator.CreateInstance(type);
plugins.Add(instance as IPlugin);
}
}
return plugins;
}
}
Ako zrušim danú instanciu tak aby som mohol plugin vymazat z disku? Dakujem moc za pomoc.