Add Saveable async methods

This commit is contained in:
sunkaixuan 2019-05-09 20:36:57 +08:00
parent 83812c9d52
commit 566e75fe67
2 changed files with 23 additions and 0 deletions

View File

@ -80,6 +80,7 @@ namespace SqlSugar
}
}
#region Core
public int ExecuteCommand()
{
LoadInsertable();
@ -118,6 +119,23 @@ namespace SqlSugar
updateable.ExecuteCommand();
return saveObjects;
}
#endregion
#region Core Async
public Task<int> ExecuteCommandAsync()
{
return Task.FromResult(ExecuteCommand());
}
public Task<T> ExecuteReturnEntityAsync()
{
return Task.FromResult(ExecuteReturnEntity());
}
public Task<List<T>> ExecuteReturnListAsync()
{
return Task.FromResult(ExecuteReturnList());
}
#endregion
public ISaveable<T> InsertColumns(Expression<Func<T, object>> columns)
{
LoadInsertable();

View File

@ -3,11 +3,16 @@ using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace SqlSugar
{
public partial interface ISaveable<T> where T : class, new()
{
Task<int> ExecuteCommandAsync();
Task<T> ExecuteReturnEntityAsync();
Task<List<T>> ExecuteReturnListAsync();
int ExecuteCommand();
T ExecuteReturnEntity();
List<T> ExecuteReturnList();