Ejemplo n.º 1
0
        public void DeletePlugin(Guid pluginId)
        {
            var plugin = GetPlugin(pluginId);

            if (plugin != null)
            {
                if (plugin.IsEnable)
                {
                    DisablePlugin(pluginId);
                }

                var migrations = _myContext.PluginMigrations.
                                 OrderByDescending(x => x.Version).
                                 Where(x => x.PluginId.Equals(pluginId)).
                                 ToList();
                foreach (var item in migrations)
                {
                    _myContext.Database.ExecuteSqlCommand(item.Down);
                }
                _myContext.PluginMigrations.RemoveRange(migrations);

                _myContext.Plugins.Remove(plugin);
                _mvcModuleSetup.DeleteModule(plugin.Name);
                _myContext.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        public void DeletePlugin(Guid pluginId)
        {
            PluginViewModel plugin = _unitOfWork.PluginRepository.GetPlugin(pluginId);

            if (plugin.IsEnable)
            {
                DisablePlugin(pluginId);
            }

            _unitOfWork.PluginRepository.RunDownMigrations(pluginId);
            _unitOfWork.PluginRepository.DeletePlugin(pluginId);
            _unitOfWork.Commit();

            _mvcModuleSetup.DeleteModule(plugin.Name);
        }
        public async Task DeletePlugin(int pluginId)
        {
            PluginInfo plugininfo = await Daos.CurrentDao.Get <PluginInfo>(pluginId);


            if (plugininfo.IsEnable)
            {
                await DisablePlugin(pluginId);
            }
            await Daos.CurrentDao.Delete(plugininfo);

            await Daos.CurrentDao.Flush();

            _mvcModuleSetup.DeleteModule(plugininfo.Name);
            if (plugininfo.IsMigration)
            {
                _autoMigration.GenerateMigrations();
            }
        }