/// <summary> /// 通过唯一Id删除对象实例。 /// </summary> /// <param name="id">唯一Id。</param> /// <returns>返回删除结果。</returns> public virtual DataResult Delete(TKey id) { return(DataResult.FromResult(Context.Delete(id), DataAction.Deleted)); }
/// <summary> /// 根据条件更新特定的实例。 /// </summary> /// <param name="expression">条件表达式。</param> /// <param name="satement">更新对象。</param> /// <returns>返回更新结果。</returns> public virtual DataResult Update(Expression <Predicate <TModel> > expression, object satement) { return(DataResult.FromResult(Context.Update(expression, satement), DataAction.Updated)); }
/// <summary> /// 根据条件删除实例。 /// </summary> /// <param name="expression">条件表达式。</param> /// <returns>返回删除结果。</returns> public virtual DataResult Delete(Expression <Predicate <TModel> > expression) { return(DataResult.FromResult(Context.Delete(expression), DataAction.Deleted)); }
/// <summary> /// 通过唯一Id删除对象实例。 /// </summary> /// <param name="id">唯一Id。</param> /// <param name="cancellationToken">取消标识。</param> /// <returns>返回删除结果。</returns> public virtual async Task <DataResult> DeleteAsync(TKey id, CancellationToken cancellationToken = default) { return(DataResult.FromResult(await Context.DeleteAsync(id, cancellationToken), DataAction.Deleted)); }
/// <summary> /// 根据条件更新特定的实例。 /// </summary> /// <param name="id">唯一Id。</param> /// <param name="satement">更新对象。</param> /// <returns>返回更新结果。</returns> public virtual DataResult Update(TKey id, object satement) { return(DataResult.FromResult(Context.Update(id, satement), DataAction.Updated)); }
/// <summary> /// 通过唯一Id删除对象实例。 /// </summary> /// <param name="ids">唯一Id集合。</param> /// <param name="cancellationToken">取消标识。</param> /// <returns>返回删除结果。</returns> public virtual async Task <DataResult> DeleteAsync(IEnumerable <TKey> ids, CancellationToken cancellationToken = default) { return(DataResult.FromResult(await Context.DeleteAsync(x => x.Id.Included(ids), cancellationToken), DataAction.Deleted)); }
/// <summary> /// 根据条件删除实例。 /// </summary> /// <param name="expression">条件表达式。</param> /// <param name="cancellationToken">取消标识。</param> /// <returns>返回删除结果。</returns> public virtual async Task <DataResult> DeleteAsync(Expression <Predicate <TModel> > expression, CancellationToken cancellationToken = default) { return(DataResult.FromResult(await Context.DeleteAsync(expression, cancellationToken), DataAction.Deleted)); }
/// <summary> /// 通过唯一Id删除对象实例。 /// </summary> /// <param name="ids">唯一Id集合。</param> /// <returns>返回删除结果。</returns> public virtual DataResult Delete(IEnumerable <TKey> ids) { return(DataResult.FromResult(Context.Delete(x => x.Id.Included(ids)), DataAction.Deleted)); }
/// <summary> /// 根据条件更新特定的实例。 /// </summary> /// <param name="expression">条件表达式。</param> /// <param name="satement">更新对象。</param> /// <param name="cancellationToken">取消标识。</param> /// <returns>返回更新结果。</returns> public virtual async Task <DataResult> UpdateAsync(Expression <Predicate <TModel> > expression, object satement, CancellationToken cancellationToken = default) { return(DataResult.FromResult(await Context.UpdateAsync(expression, satement, cancellationToken), DataAction.Updated)); }
/// <summary> /// 根据条件更新特定的实例。 /// </summary> /// <param name="id">唯一Id。</param> /// <param name="satement">更新对象。</param> /// <param name="cancellationToken">取消标识。</param> /// <returns>返回更新结果。</returns> public virtual async Task <DataResult> UpdateAsync(TKey id, object satement, CancellationToken cancellationToken = default) { return(DataResult.FromResult(await Context.UpdateAsync(id, satement, cancellationToken), DataAction.Updated)); }
/// <summary> /// 删除实例对象。 /// </summary> /// <param name="ids">Id集合。</param> /// <returns>返回删除结果。</returns> public virtual DataResult Delete(int[] ids) { return(DataResult.FromResult(Database.Delete(x => x.Id.Included(ids)), DataAction.Deleted)); }
/// <summary> /// 删除实例对象。 /// </summary> /// <param name="id">Id。</param> /// <returns>返回删除结果。</returns> public virtual DataResult Delete(int id) { return(DataResult.FromResult(Database.Delete(x => x.Id == id), DataAction.Deleted)); }