mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-24 13:03:43 +08:00
Synchronization code
This commit is contained in:
@@ -217,20 +217,18 @@ namespace SqlSugar
|
||||
if (this.Transaction == null)
|
||||
this.Transaction =await (this.Connection as DbConnection).BeginTransactionAsync();
|
||||
}
|
||||
|
||||
public virtual async Task BeginTranAsync(IsolationLevel iso)
|
||||
{
|
||||
await CheckConnectionAsync();
|
||||
if (this.Transaction == null)
|
||||
this.Transaction =await (this.Connection as DbConnection).BeginTransactionAsync(iso);
|
||||
}
|
||||
|
||||
public virtual void BeginTran(IsolationLevel iso)
|
||||
{
|
||||
CheckConnection();
|
||||
if (this.Transaction == null)
|
||||
this.Transaction = this.Connection.BeginTransaction(iso);
|
||||
}
|
||||
public virtual async Task BeginTranAsync(IsolationLevel iso)
|
||||
{
|
||||
await CheckConnectionAsync();
|
||||
if (this.Transaction == null)
|
||||
this.Transaction =await (this.Connection as DbConnection).BeginTransactionAsync(iso);
|
||||
}
|
||||
public virtual void RollbackTran()
|
||||
{
|
||||
if (this.Transaction != null)
|
||||
|
@@ -562,6 +562,7 @@ namespace SqlSugar
|
||||
queryable.QueryBuilder.LambdaExpressions.ParameterIndex = parameterIndex;
|
||||
CheckHasRootShortName(method.Arguments[0], method.Arguments[1]);
|
||||
var exp = method.Arguments[1];
|
||||
InitMappingtType(exp);
|
||||
where.Add(" " + queryable.QueryBuilder.GetExpressionValue(exp, ResolveExpressType.WhereSingle).GetString());
|
||||
SetTableShortName(result, queryable);
|
||||
parameterIndex=queryable.QueryBuilder.LambdaExpressions.ParameterIndex ;
|
||||
@@ -574,6 +575,7 @@ namespace SqlSugar
|
||||
{
|
||||
queryable.QueryBuilder.LambdaExpressions.ParameterIndex = parameterIndex;
|
||||
var exp = method.Arguments[2];
|
||||
InitMappingtType(exp);
|
||||
CheckHasRootShortName(method.Arguments[1], method.Arguments[2]);
|
||||
where.Add(" " + queryable.QueryBuilder.GetExpressionValue(exp, ResolveExpressType.WhereSingle).GetString());
|
||||
SetTableShortName(result, queryable);
|
||||
@@ -796,5 +798,21 @@ namespace SqlSugar
|
||||
return shortName;
|
||||
}
|
||||
|
||||
private void InitMappingtType(Expression exp)
|
||||
{
|
||||
if (exp is LambdaExpression)
|
||||
{
|
||||
var pars = (exp as LambdaExpression).Parameters;
|
||||
if (pars != null)
|
||||
{
|
||||
foreach (var item in pars)
|
||||
{
|
||||
this.Context.InitMappingInfo(item.Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user