mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-03 12:18:00 +08:00
Synchronization code
This commit is contained in:
parent
efd5596c89
commit
a657925567
@ -370,17 +370,31 @@ namespace SqlSugar
|
|||||||
public T ExecuteReturnEntity(bool isIncludesAllFirstLayer)
|
public T ExecuteReturnEntity(bool isIncludesAllFirstLayer)
|
||||||
{
|
{
|
||||||
var data = ExecuteReturnEntity();
|
var data = ExecuteReturnEntity();
|
||||||
return this.Context.Queryable<T>().WhereClassByPrimaryKey(data).IncludesAllFirstLayer().First();
|
if (this.InsertBuilder.IsWithAttr)
|
||||||
|
{
|
||||||
|
return this.Context.Root.QueryableWithAttr<T>().WhereClassByPrimaryKey(data).IncludesAllFirstLayer().First();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return this.Context.Queryable<T>().WhereClassByPrimaryKey(data).IncludesAllFirstLayer().First();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public async Task<T> ExecuteReturnEntityAsync()
|
public async Task<T> ExecuteReturnEntityAsync()
|
||||||
{
|
{
|
||||||
await ExecuteCommandIdentityIntoEntityAsync();
|
await ExecuteCommandIdentityIntoEntityAsync();
|
||||||
return InsertObjs.First();
|
return InsertObjs.First();
|
||||||
}
|
}
|
||||||
public async Task<T> ExecuteReturnEntityAsync(bool isIncludesAllFirstLayer)
|
public async Task<T> ExecuteReturnEntityAsync(bool isIncludesAllFirstLayer)
|
||||||
{
|
{
|
||||||
var data=await ExecuteReturnEntityAsync();
|
var data = await ExecuteReturnEntityAsync();
|
||||||
return await this.Context.Queryable<T>().WhereClassByPrimaryKey(data).IncludesAllFirstLayer().FirstAsync();
|
if (this.InsertBuilder.IsWithAttr)
|
||||||
|
{
|
||||||
|
return await this.Context.Root.QueryableWithAttr<T>().WhereClassByPrimaryKey(data).IncludesAllFirstLayer().FirstAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return await this.Context.Queryable<T>().WhereClassByPrimaryKey(data).IncludesAllFirstLayer().FirstAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public async Task<bool> ExecuteCommandIdentityIntoEntityAsync()
|
public async Task<bool> ExecuteCommandIdentityIntoEntityAsync()
|
||||||
{
|
{
|
||||||
|
@ -132,6 +132,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool MySqlIgnore { get; internal set; }
|
public bool MySqlIgnore { get; internal set; }
|
||||||
|
public bool IsWithAttr { get; internal set; }
|
||||||
|
|
||||||
public virtual ExpressionResult GetExpressionValue(Expression expression, ResolveExpressType resolveType)
|
public virtual ExpressionResult GetExpressionValue(Expression expression, ResolveExpressType resolveType)
|
||||||
{
|
{
|
||||||
|
@ -1546,11 +1546,15 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
public IInsertable<T> InsertableWithAttr<T>(T insertObj) where T : class, new()
|
public IInsertable<T> InsertableWithAttr<T>(T insertObj) where T : class, new()
|
||||||
{
|
{
|
||||||
return this.GetConnectionWithAttr<T>().Insertable(insertObj);
|
var result= this.GetConnectionWithAttr<T>().Insertable(insertObj);
|
||||||
|
result.InsertBuilder.IsWithAttr = true;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
public IInsertable<T> InsertableWithAttr<T>(List<T> insertObjs) where T : class, new()
|
public IInsertable<T> InsertableWithAttr<T>(List<T> insertObjs) where T : class, new()
|
||||||
{
|
{
|
||||||
return this.GetConnectionWithAttr<T>().Insertable(insertObjs);
|
var result= this.GetConnectionWithAttr<T>().Insertable(insertObjs);
|
||||||
|
result.InsertBuilder.IsWithAttr = true;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
public IUpdateable<T> UpdateableWithAttr<T>(T updateObj) where T : class, new()
|
public IUpdateable<T> UpdateableWithAttr<T>(T updateObj) where T : class, new()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user