Exp to sql bug

This commit is contained in:
610262374@qq.com 2019-01-02 17:53:49 +08:00
parent 93f465c96a
commit 53783af1f3

View File

@ -337,7 +337,8 @@ namespace SqlSugar
if (this.Context.Result.IsLockCurrentParameter == false)
{
var expression = ((UnaryExpression)item).Operand as MemberExpression;
if (expression.Expression == null)
var isDateTimeNow = ((UnaryExpression)item).Operand.ToString() == "DateTime.Now";
if (expression.Expression == null&&!isDateTimeNow)
{
this.Context.Result.CurrentParameter = parameter;
this.Context.Result.IsLockCurrentParameter = true;
@ -348,7 +349,7 @@ namespace SqlSugar
this.Context.Result.Append(this.Context.GetAsString(asName, parameter.CommonTempData.ObjToString()));
this.Context.Result.CurrentParameter = null;
}
else if (expression.Expression is ConstantExpression)
else if (expression.Expression is ConstantExpression||isDateTimeNow)
{
string parameterName = this.Context.SqlParameterKeyWord + "constant" + this.Context.ParameterIndex;
this.Context.ParameterIndex++;