Browse Source

Update exp to sql

pull/8/head
sunkaixuna 3 years ago
parent
commit
0c1195b287
  1. 14
      Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubAnd.cs
  2. 14
      Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs

14
Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubAnd.cs

@ -56,8 +56,18 @@ namespace SqlSugar
if (Regex.IsMatch(result, regex))
{
var value = GetValue(result, regex);
result = "AND " + value;
return result;
if (value is Expression)
{
var p = this.Context.Parameters.First(it => it.ParameterName == Regex.Match(result, regex).Groups[1].Value);
result = "AND " + SubTools.GetMethodValue(Context, value as Expression, ResolveExpressType.WhereMultiple);
argExp = value as Expression;
p.Value = argExp.ToString();
}
else
{
result = "AND " + value;
return result;
}
}
var selfParameterName = this.Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot;

14
Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/Items/SubWhere.cs

@ -56,8 +56,18 @@ namespace SqlSugar
if (Regex.IsMatch(result, regex))
{
var value = GetValue(result, regex);
result = "WHERE " + value;
return result;
if (value is Expression)
{
var p = this.Context.Parameters.First(it => it.ParameterName == Regex.Match(result, regex).Groups[1].Value);
result = "WHERE " + SubTools.GetMethodValue(Context, value as Expression, ResolveExpressType.WhereMultiple);
argExp = value as Expression;
p.Value = argExp.ToString();
}
else
{
result = "WHERE " + value;
return result;
}
}
var selfParameterName = Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot;

Loading…
Cancel
Save