mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-01 18:59:35 +08:00
Update ExpressionToSql
This commit is contained in:
parent
f6a9a80383
commit
1e556ed435
@ -122,6 +122,8 @@ namespace SqlSugar
|
||||
{
|
||||
ExpressionContext copyContext = (ExpressionContext)Activator.CreateInstance(this.GetType(), true);
|
||||
copyContext.Index = this.Index;
|
||||
copyContext.InitMappingInfo = this.InitMappingInfo;
|
||||
copyContext.RefreshMapping = this.RefreshMapping;
|
||||
copyContext.ParameterIndex = this.ParameterIndex;
|
||||
return copyContext;
|
||||
}
|
||||
@ -134,6 +136,8 @@ namespace SqlSugar
|
||||
copyContext.MappingTables = this.MappingTables;
|
||||
copyContext.IgnoreComumnList = this.IgnoreComumnList;
|
||||
copyContext.SqlFuncServices = this.SqlFuncServices;
|
||||
copyContext.InitMappingInfo = this.InitMappingInfo;
|
||||
copyContext.RefreshMapping = this.RefreshMapping;
|
||||
return copyContext;
|
||||
}
|
||||
#endregion
|
||||
|
@ -396,6 +396,9 @@ namespace SqlSugar
|
||||
}
|
||||
this.Context.Result.Append(this.Context.GetAsString(asName, newContext.Result.GetString()));
|
||||
this.Context.Result.CurrentParameter = null;
|
||||
if (this.Context.SingleTableNameSubqueryShortName.IsNullOrEmpty() && newContext.SingleTableNameSubqueryShortName.HasValue()) {
|
||||
this.Context.SingleTableNameSubqueryShortName = newContext.SingleTableNameSubqueryShortName;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (item.Type.IsClass())
|
||||
|
@ -47,6 +47,18 @@ namespace SqlSugar
|
||||
context.SingleTableNameSubqueryShortName = (((meExp.Body as BinaryExpression).Right as MemberExpression).Expression as ParameterExpression).Name;
|
||||
}
|
||||
}
|
||||
else if (context.Expression.GetType().Name == "MethodBinaryExpression")
|
||||
{
|
||||
|
||||
var subExp = (context.Expression as BinaryExpression).Left is MethodCallExpression ? (context.Expression as BinaryExpression).Left : (context.Expression as BinaryExpression).Right;
|
||||
var meExp = ((subExp as MethodCallExpression).Object as MethodCallExpression).Arguments[0] as LambdaExpression;
|
||||
var selfParameterName = meExp.Parameters.First().Name;
|
||||
context.SingleTableNameSubqueryShortName = (((meExp.Body as BinaryExpression).Left as MemberExpression).Expression as ParameterExpression).Name;
|
||||
if (context.SingleTableNameSubqueryShortName == selfParameterName)
|
||||
{
|
||||
context.SingleTableNameSubqueryShortName = (((meExp.Body as BinaryExpression).Right as MemberExpression).Expression as ParameterExpression).Name;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Check.Exception(true, "I'm sorry I can't parse the current expression");
|
||||
|
Loading…
Reference in New Issue
Block a user