示例#1
0
        /// <summary>
        /// 将指定的实体对象从库中移除。
        /// </summary>
        /// <param name="entity">要移除的实体对象。</param>
        /// <param name="logicalDelete">是否为逻辑删除。</param>
        /// <returns>影响的实体数。</returns>
        public virtual int Delete(TEntity entity, bool logicalDelete = true)
        {
            Guard.ArgumentNull(entity, nameof(entity));

            return(_subMgr.OnRemove <TEntity, int>(_contextService.ServiceProvider, _options.NotifyEvents, entity,
                                                   () => _repositoryProxy.Delete(entity, logicalDelete)));
        }
示例#2
0
        /// <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));

            int func() => repositoryProxy.Delete(entity, logicalDelete);

            return(options.NotifyEvents ?
                   EntityPersistentSubscribeManager.OnRemove(entity, func) : func());
        }
        public async Task<ServiceResponse> Delete(int idProvider)
        {
            var sr = new ServiceResponse();

            try
            {
                sr.Data = await _repositoryProvider.Delete(idProvider);
            }
            catch (Exception ex)
            {
                sr.AddError(ex);
            }

            return sr;
        }
示例#4
0
        /// <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(EntityPersistentSubscribePublisher.OnRemove(entity, () => repositoryProxy.Delete(entity, logicalDelete)));
        }
示例#5
0
 /// <summary>
 /// 将指定的实体对象从库中移除。
 /// </summary>
 /// <param name="entity">要移除的实体对象。</param>
 /// <param name="logicalDelete">是否为逻辑删除。</param>
 /// <returns>影响的实体数。</returns>
 public int Delete(TEntity entity, bool logicalDelete = true)
 {
     Guard.ArgumentNull(entity, "entity");
     return(repositoryProxy.Delete(entity, logicalDelete));
 }