public void ReLoadModule(string moduleName, bool isReInstall = true) { if (_pluginsLoadContexts.Any(moduleName)) { var context = _pluginsLoadContexts.Get(moduleName); foreach (var part in context.PluginAssemblyParts) { _partManager.ApplicationParts.Remove(part); } _pluginsLoadContexts.Remove(moduleName); ResetControllActions(); } LoadModule(moduleName, isReInstall); }
public async Task AddPlugins(PluginInfoDto plugininfo) { PluginInfoDto existedPlugin = await this.Get <PluginInfoDto>(p => p.Name == plugininfo.Name); if (existedPlugin == null) { await InitializePlugin(plugininfo); } else if (new Version(plugininfo.Version) > new Version(existedPlugin.Version)) { await UpgradePlugin(plugininfo, existedPlugin); } else if (new Version(plugininfo.Version) == new Version(existedPlugin.Version)) { throw new ArgumentException("The package version is same as the current plugin version."); } else { await DegradePlugin(plugininfo, existedPlugin); } if (plugininfo.IsMigration) { _autoMigration.GenerateMigrations(); } var pluginContext = _puginsAssemblyLoadContexts.Get(plugininfo.Name).PluginContext; if (pluginContext.TestUrl?.Any() == true) { var model = await Daos.CurrentDao.SingleAsync <PluginInfo>(p => p.Name == plugininfo.Name); model.TestUrl = pluginContext.TestUrl; model.RouteArea = pluginContext.RouteArea; await Daos.CurrentDao.Flush(); //await Daos.CurrentDao.Update<PluginInfo>(p => p.Name == plugininfo.Name, p => new PluginInfo { TestUrl = pluginContext.TestUrl, RouteArea = pluginContext.RouteArea }); } }