Add: db.Insertable(x).ExecuteReturnEntity(bool isIncludesAllFirstLayer()

This commit is contained in:
sunkaixuan
2023-10-09 18:56:18 +08:00
parent 84189b718d
commit 6793b6e773
2 changed files with 12 additions and 0 deletions

View File

@@ -367,11 +367,21 @@ namespace SqlSugar
After(sql, result);
return result;
}
public T ExecuteReturnEntity(bool isIncludesAllFirstLayer)
{
var data = ExecuteReturnEntity();
return this.Context.Queryable<T>().WhereClassByPrimaryKey(data).IncludesAllFirstLayer().First();
}
public async Task<T> ExecuteReturnEntityAsync()
{
await ExecuteCommandIdentityIntoEntityAsync();
return InsertObjs.First();
}
public async Task<T> ExecuteReturnEntityAsync(bool isIncludesAllFirstLayer)
{
var data=await ExecuteReturnEntityAsync();
return await this.Context.Queryable<T>().WhereClassByPrimaryKey(data).IncludesAllFirstLayer().FirstAsync();
}
public async Task<bool> ExecuteCommandIdentityIntoEntityAsync()
{
var result = InsertObjs.First();

View File

@@ -26,7 +26,9 @@ namespace SqlSugar
Task<int> ExecuteReturnIdentityAsync();
Task<int> ExecuteReturnIdentityAsync(CancellationToken token);
T ExecuteReturnEntity();
T ExecuteReturnEntity(bool isIncludesAllFirstLayer);
Task<T> ExecuteReturnEntityAsync();
Task<T> ExecuteReturnEntityAsync(bool isIncludesAllFirstLayer);
bool ExecuteCommandIdentityIntoEntity();
Task<bool> ExecuteCommandIdentityIntoEntityAsync();
long ExecuteReturnBigIdentity();