public bool DeleteById(params Guid[] ids) { Guard.NotEmpty(ids, nameof(ids)); var deleteds = _entityPluginRepository.Query(x => x.EntityPluginId.In(ids.ToArray())); if (deleteds.IsEmpty()) { return(false); } return(DeleteCore(deleteds.ToArray())); }
public List <EntityPlugin> QueryByEntityId(Guid entityid, string eventName, Guid?businessObjectId = null, PlugInType typeCode = PlugInType.Entity) { List <EntityPlugin> entities = _cacheService.GetVersionItems(entityid + "/" + eventName, () => { return(_entityPluginRepository.Query(x => x.EntityId == entityid)?.ToList()); }); if (entities.NotEmpty()) { if (businessObjectId.HasValue) { entities.RemoveAll(x => !(x.EventName.IsCaseInsensitiveEqual(eventName) && x.BusinessObjectId == businessObjectId.Value && x.TypeCode == (int)typeCode)); } else { entities.RemoveAll(x => !(x.EventName.IsCaseInsensitiveEqual(eventName) && x.BusinessObjectId == Guid.Empty && x.TypeCode == (int)typeCode)); } } return(entities.OrderBy(x => x.ProcessOrder).ToList()); }
public bool UpdateState(IEnumerable <Guid> ids, bool isEnabled) { var context = UpdateContextBuilder.Build <EntityPlugin>(); context.Set(f => f.StateCode, isEnabled ? RecordState.Enabled : RecordState.Disabled); context.Where(f => f.EntityPluginId.In(ids)); var result = false; using (UnitOfWork.Build(_entityPluginRepository.DbContext)) { result = _entityPluginRepository.Update(context); //set to cache var items = _entityPluginRepository.Query(x => x.EntityPluginId.In(ids)); foreach (var item in items) { _cacheService.SetEntity(item); } } return(result); }