This commit is contained in:
sunkaixuan 2017-01-08 15:36:28 +08:00
parent 57c2cba748
commit ffe83f16c3
19 changed files with 20 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -9,7 +9,7 @@ namespace SqlSugar
public class BinaryExpressionInfo public class BinaryExpressionInfo
{ {
public bool IsLeft { get; set; } public bool IsLeft { get; set; }
public ExpressionType ExpressionType { get;set;} public Type ExpressionType { get;set;}
public object Value { get; set; } public object Value { get; set; }
} }
} }

View File

@ -1,8 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions;
using System.Text; using System.Text;
namespace SqlSugar namespace SqlSugar
{ {
internal class ExpressionConst internal class ExpressionConst
@ -11,6 +11,8 @@ namespace SqlSugar
public const string BinaryFormatString = " ( {0} {1} {2} ) "; public const string BinaryFormatString = " ( {0} {1} {2} ) ";
public const string Format0 = "{0}"; public const string Format0 = "{0}";
public const string Format1 = "{1}"; public const string Format1 = "{1}";
public readonly static Type MemberExpressionType = typeof(MemberExpression);
public readonly static Type ConstantExpressionType = typeof(ConstantExpression);
internal static string GetThrowMessage(string enMessage, string cnMessage, params string[] args) internal static string GetThrowMessage(string enMessage, string cnMessage, params string[] args)
{ {
List<string> formatArgs = new List<string>() { enMessage, cnMessage }; List<string> formatArgs = new List<string>() { enMessage, cnMessage };
@ -19,8 +21,6 @@ namespace SqlSugar
} }
} }
internal partial class ErrorMessage internal partial class ErrorMessage
{ {
internal static string OperatorError internal static string OperatorError
{ {

View File

@ -11,6 +11,13 @@ namespace SqlSugar
{ {
public ResolveExpressType Type { get; set; } public ResolveExpressType Type { get; set; }
public Expression Expression { get; set; } public Expression Expression { get; set; }
public virtual string SqlParameterKeyWord
{
get
{
return "@";
}
}
public virtual string GetaMppingColumnsName(string name) public virtual string GetaMppingColumnsName(string name)
{ {
return name; return name;

View File

@ -50,6 +50,13 @@ namespace SqlSugar
{ {
var leftInfo = parameter.BinaryExpressionInfoList.Single(it => it.Value.IsLeft).Value; var leftInfo = parameter.BinaryExpressionInfoList.Single(it => it.Value.IsLeft).Value;
var rightInfo = parameter.BinaryExpressionInfoList.Single(it => !it.Value.IsLeft).Value; var rightInfo = parameter.BinaryExpressionInfoList.Single(it => !it.Value.IsLeft).Value;
if (leftInfo.ExpressionType == ExpressionConst.ConstantExpressionType)
{
var sqlParameterKeyWord = parameter.Context.SqlParameterKeyWord;
var reval= string.Format("{0}{1}{2}",sqlParameterKeyWord,leftInfo.Value,parameter.Context.Index+parameter.Index);
parameter.Context.Parameters.Add(new SugarParameter(reval,leftInfo.Value));
return reval;
}
return leftInfo.Value.ObjToString(); return leftInfo.Value.ObjToString();
} }

View File

@ -18,7 +18,7 @@ namespace SqlSugar
{ {
IsLeft = Convert.ToBoolean(IsLeft), IsLeft = Convert.ToBoolean(IsLeft),
Value = fieldName, Value = fieldName,
ExpressionType = expression.NodeType ExpressionType = expression.GetType()
})); }));
if (isLeft == null && base.SqlWhere == null) if (isLeft == null && base.SqlWhere == null)
{ {

Binary file not shown.

Binary file not shown.

View File

@ -3,3 +3,4 @@ F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\bin\Debug\SqlSugar.pdb
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\bin\Debug\Newtonsoft.Json.dll F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\bin\Debug\Newtonsoft.Json.dll
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\obj\Debug\SqlSugar.dll F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\obj\Debug\SqlSugar.dll
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\obj\Debug\SqlSugar.pdb F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\obj\Debug\SqlSugar.pdb
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\obj\Debug\SqlSugar.csprojResolveAssemblyReference.cache

Binary file not shown.

Binary file not shown.