Browse Source

-

pull/12/MERGE
sunkaixuan 8 years ago
parent
commit
cafc76483a
  1. BIN
      .vs/SqlSugar/v14/.suo
  2. 21
      SqlSugar/ExpressionsToSql/ResolveItems/ConstantExpressionResolve.cs
  3. 13
      SqlSugar/ExpressionsToSql/ResolveItems/MemberExpressionResolve.cs

BIN
.vs/SqlSugar/v14/.suo

Binary file not shown.

21
SqlSugar/ExpressionsToSql/ResolveItems/ConstantExpressionResolve.cs

@ -5,11 +5,28 @@ using System.Linq.Expressions;
using System.Text;
namespace SqlSugar
{
public class ConstantExpressionResolve:BaseResolve
public class ConstantExpressionResolve : BaseResolve
{
public ConstantExpressionResolve(ExpressionParameter parameter) : base(parameter)
{
var expression = base.Expression as MemberExpression;
var isLeft = parameter.IsLeft;
var isSingle = parameter.Context.IsSingle;
string value = string.Empty;
if (parameter.BaseParameter.BinaryExpressionInfoList != null)
{
parameter.BaseParameter.BinaryExpressionInfoList.Add(new KeyValuePair<string, BinaryExpressionInfo>(ExpressionConst.BinaryExpressionInfoListKey, new BinaryExpressionInfo()
{
IsLeft = Convert.ToBoolean(IsLeft),
Value = value,
ExpressionType = expression.GetType()
}));
}
if (isLeft == null && base.SqlWhere == null)
{
base.SqlWhere = new StringBuilder();
base.SqlWhere.Append(value);
}
}
}
}

13
SqlSugar/ExpressionsToSql/ResolveItems/MemberExpressionResolve.cs

@ -14,12 +14,13 @@ namespace SqlSugar
var isSingle = parameter.Context.IsSingle;
string fieldName = string.Empty;
fieldName = isSingle ? expression.Member.Name : expression.Member.ToString();
parameter.BaseParameter.BinaryExpressionInfoList.Add(new KeyValuePair<string, BinaryExpressionInfo>(ExpressionConst.BinaryExpressionInfoListKey, new BinaryExpressionInfo()
{
IsLeft = Convert.ToBoolean(IsLeft),
Value = fieldName,
ExpressionType = expression.GetType()
}));
if (parameter.BaseParameter.BinaryExpressionInfoList != null)
parameter.BaseParameter.BinaryExpressionInfoList.Add(new KeyValuePair<string, BinaryExpressionInfo>(ExpressionConst.BinaryExpressionInfoListKey, new BinaryExpressionInfo()
{
IsLeft = Convert.ToBoolean(IsLeft),
Value = fieldName,
ExpressionType = expression.GetType()
}));
if (isLeft == null && base.SqlWhere == null)
{
base.SqlWhere = new StringBuilder();

Loading…
Cancel
Save