public bool DeleteById(bool deleteTable = true, params Guid[] id) { Guard.NotEmpty(id, nameof(id)); var result = false; using (UnitOfWork.Build(_entityRepository.DbContext)) { foreach (var item in id) { var deleted = _entityRepository.FindById(item); if (deleted == null || !deleted.IsCustomizable) { continue; } //检查依赖项 _dependencyChecker.CheckAndThrow <Domain.Entity>(EntityDefaults.ModuleName, item); //cascade delete _cascadeDeletes?.ToList().ForEach((x) => { x.CascadeDelete(deleted); }); result = _entityRepository.DeleteById(item, deleteTable); //删除依赖项 _dependencyService.DeleteByDependentId(EntityDefaults.ModuleName, item); //solution component _solutionComponentService.DeleteObject(deleted.SolutionId, deleted.EntityId, EntityDefaults.ModuleName); //entity localization _localizedLabelService.DeleteByObject(deleted.EntityId); //remove from cache _cacheService.RemoveEntity(deleted); } } return(result); }
public bool DeleteById(params Guid[] id) { Guard.NotEmpty(id, nameof(id)); var result = true; foreach (var item in id) { var deleted = _webResourceRepository.FindById(item); if (deleted == null) { return(false); } //检查依赖项 _dependencyChecker.CheckAndThrow <Domain.WebResource>(WebResourceDefaults.ModuleName, deleted.WebResourceId); bool flag = _webResourceRepository.DeleteById(item); if (flag) { //删除依赖项 _dependencyService.DeleteByDependentId(WebResourceDefaults.ModuleName, id); //solution component _solutionComponentService.DeleteObject(deleted.SolutionId, deleted.WebResourceId, WebResourceDefaults.ModuleName); //localization _localizedLabelService.DeleteByObject(item); _cacheService.RemoveEntity(deleted); } } return(result); }
private bool DeleteCore(IEnumerable <Domain.OptionSet> deleteds, Func <Domain.OptionSet, bool> validation) { Guard.NotEmpty(deleteds, nameof(deleteds)); var result = true; foreach (var deleted in deleteds) { result = validation?.Invoke(deleted) ?? true; } if (result) { var ids = deleteds.Select(x => x.OptionSetId).ToArray(); using (UnitOfWork.Build(_optionSetRepository.DbContext)) { //cascade delete _cascadeDeletes?.ToList().ForEach((x) => { x.CascadeDelete(deleteds.ToArray()); }); result = _optionSetRepository.DeleteMany(ids); //删除依赖项 _dependencyService.DeleteByDependentId(OptionSetDefaults.ModuleName, ids); //localization _localizedLabelService.DeleteByObject(ids); foreach (var deleted in deleteds) { //solution component _solutionComponentService.DeleteObject(deleted.SolutionId, deleted.OptionSetId, OptionSetDefaults.ModuleName); //remove from cache _cacheService.RemoveEntity(deleted); } } } return(result); }
public bool DeleteById(params Guid[] ids) { if (ids.IsEmpty()) { return(false); } var deleteds = _processStageRepository.Query(x => x.ProcessStageId.In(ids)); if (deleteds.IsEmpty()) { return(false); } var result = true; using (UnitOfWork.Build(_processStageRepository.DbContext)) { result = _processStageRepository.DeleteMany(ids); _dependencyService.DeleteByDependentId(WorkFlowDefaults.ModuleName, deleteds.Select(x => x.WorkFlowId).ToArray()); } return(result); }
private bool DeleteCore(params EntityPlugin[] deleteds) { Guard.NotEmpty(deleteds, nameof(deleteds)); var result = true; var solutionId = deleteds.First().SolutionId; var ids = deleteds.Select(x => x.EntityPluginId).ToArray(); using (UnitOfWork.Build(_entityPluginRepository.DbContext)) { result = _entityPluginRepository.DeleteMany(ids); //solution component _solutionComponentService.DeleteObject(solutionId, PluginDefaults.ModuleName, ids); //删除依赖项 _dependencyService.DeleteByDependentId(PluginDefaults.ModuleName, ids); //remove from cache foreach (var deleted in deleteds) { _cacheService.RemoveEntity(deleted); } } return(result); }
public bool Delete(params Guid[] id) { //删除依赖项 return(_dependencyService.DeleteByDependentId(FilterRuleDefaults.ModuleName, id)); }
public bool Delete(params Guid[] id) { return(_dependencyService.DeleteByDependentId(WorkFlowDefaults.ModuleName, id));; }
public bool Delete(params Guid[] id) { return(_dependencyService.DeleteByDependentId(SerialNumberRuleDefaults.ModuleName, id));; }
public bool Delete(params Guid[] id) { return(_dependencyService.DeleteByDependentId(RibbonButtonDefaults.ModuleName, id));; }