/// <summary> /// 将指定的实体对象从库中移除。 /// </summary> /// <param name="entity">要移除的实体对象。</param> /// <param name="logicalDelete">是否为逻辑删除。</param> /// <returns>影响的实体数。</returns> public int Delete(TEntity entity, bool logicalDelete = true) { Guard.ArgumentNull(entity, nameof(entity)); return(EntityPersistentSubscribeManager.OnRemove(options.NotifyEvents, entity, () => repositoryProxy.DeleteAsync(entity, logicalDelete).Result)); }
/// <summary> /// 异步的,将指定的实体对象从库中移除。 /// </summary> /// <param name="entity">要移除的实体对象。</param> /// <param name="logicalDelete">是否为逻辑删除。</param> /// <param name="cancellationToken">取消操作的通知。</param> /// <returns>影响的实体数。</returns> public async virtual Task <int> DeleteAsync(TEntity entity, bool logicalDelete = true, CancellationToken cancellationToken = default) { Guard.ArgumentNull(entity, nameof(entity)); cancellationToken.ThrowIfCancellationRequested(); return(await _subMgr.OnRemoveAsync <TEntity, int>(_contextService.ServiceProvider, _options.NotifyEvents, entity, () => _repositoryProxy.DeleteAsync(entity, logicalDelete, cancellationToken))); }
/// <summary> /// Suppression d'un aagrégat. /// </summary> /// <param name="aggregate">Agrégat.</param> public async Task DeleteAsync(AggregateT aggregate) { await provider.DeleteAsync(aggregate); }