Browse Source

-

pull/12/MERGE
sunkaixuan 8 years ago
parent
commit
9f294b0b11
  1. BIN
      .vs/SqlSugar/v14/.suo
  2. BIN
      OrmTest/bin/Debug/OrmTest.exe
  3. BIN
      OrmTest/bin/Debug/OrmTest.pdb
  4. BIN
      OrmTest/bin/Debug/SqlSugar.dll
  5. BIN
      OrmTest/bin/Debug/SqlSugar.pdb
  6. BIN
      OrmTest/obj/Debug/OrmTest.csprojResolveAssemblyReference.cache
  7. BIN
      OrmTest/obj/Debug/OrmTest.exe
  8. BIN
      OrmTest/obj/Debug/OrmTest.pdb
  9. 15
      SqlSugar/ExpressionsToSql/BinaryExpressionInfo.cs
  10. 10
      SqlSugar/ExpressionsToSql/ExpConst.cs
  11. 3
      SqlSugar/ExpressionsToSql/ExpressionParameter.cs
  12. 11
      SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs
  13. 4
      SqlSugar/ExpressionsToSql/ResolveItems/BinaryExpressionResolve.cs
  14. 8
      SqlSugar/ExpressionsToSql/ResolveItems/LambdaExpressionResolve.cs
  15. 19
      SqlSugar/ExpressionsToSql/ResolveItems/MemberExpressionResolve.cs
  16. 1
      SqlSugar/SqlSugar.csproj
  17. BIN
      SqlSugar/bin/Debug/SqlSugar.dll
  18. BIN
      SqlSugar/bin/Debug/SqlSugar.pdb
  19. BIN
      SqlSugar/obj/Debug/SqlSugar.dll
  20. BIN
      SqlSugar/obj/Debug/SqlSugar.pdb

BIN
.vs/SqlSugar/v14/.suo

Binary file not shown.

BIN
OrmTest/bin/Debug/OrmTest.exe

Binary file not shown.

BIN
OrmTest/bin/Debug/OrmTest.pdb

Binary file not shown.

BIN
OrmTest/bin/Debug/SqlSugar.dll

Binary file not shown.

BIN
OrmTest/bin/Debug/SqlSugar.pdb

Binary file not shown.

BIN
OrmTest/obj/Debug/OrmTest.csprojResolveAssemblyReference.cache

Binary file not shown.

BIN
OrmTest/obj/Debug/OrmTest.exe

Binary file not shown.

BIN
OrmTest/obj/Debug/OrmTest.pdb

Binary file not shown.

15
SqlSugar/ExpressionsToSql/BinaryExpressionInfo.cs

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace SqlSugar
{
public class BinaryExpressionInfo
{
public bool IsLeft { get; set; }
ExpressionType ExpressionType { get;set;}
public object Value { get; set; }
}
}

10
SqlSugar/ExpressionsToSql/ExpConst.cs

@ -5,7 +5,15 @@ using System.Text;
namespace SqlSugar
{
internal class ExpConst
{
public const string FiledName = "filedName";
public const string FiledValue = "FiledValue";
public const string Operator = "Operator";
}
internal partial class ErrorMessage
{
internal static string OperatorError
{
@ -23,6 +31,6 @@ namespace SqlSugar
"表达示格式错误,正确格式: it=>it.fieldName");
}
}
}
}

3
SqlSugar/ExpressionsToSql/ExpressionParameter.cs

@ -13,6 +13,7 @@ namespace SqlSugar
public bool? IsLeft { get; set; }
public Expression BaseExpression { get; set; }
public int Index { get; set; }
public Dictionary<string, string> TempData { get; set; }
public Dictionary<string, object> TempData { get; set; }
public ExpressionParameter BaseParameter { get; set; }
}
}

11
SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs

@ -11,7 +11,6 @@ namespace SqlSugar
protected Expression BaseExpression { get; set; }
public ExpressionContext Context { get; set; }
public string SqlWhere { get; set; }
public bool IsFinished { get; set; }
public bool? IsLeft { get; set; }
public int ContentIndex { get { return this.Context.Index; } }
public int Index { get; set; }
@ -25,12 +24,12 @@ namespace SqlSugar
{
this.Expression = parameter.Expression;
this.Context = parameter.Context;
this.BaseParameter = parameter;
}
public BaseResolve Start()
{
this.Index++;
this.IsFinished = false;
Expression exp = this.Expression;
ExpressionParameter parameter = new ExpressionParameter()
{
@ -38,6 +37,7 @@ namespace SqlSugar
Expression = exp,
IsLeft = this.IsLeft,
BaseExpression = this.BaseExpression,
BaseParameter=this.BaseParameter,
Index = this.Index
};
if (exp is LambdaExpression)
@ -78,12 +78,5 @@ namespace SqlSugar
}
return null;
}
public void Continue()
{
if (!IsFinished)
{
this.Start();
}
}
}
}

4
SqlSugar/ExpressionsToSql/ResolveItems/BinaryExpressionResolve.cs

@ -9,9 +9,10 @@ namespace SqlSugar
{
public BinaryExpressionResolve(ExpressionParameter parameter) : base(parameter)
{
parameter.TempData = new Dictionary<string, object>();
var expression = this.Expression as BinaryExpression;
parameter.TempData.Add(ExpConst.Operator, ExpTool.GetOperator(expression.NodeType));
base.BaseExpression = expression;
base.BaseParameter = parameter;
base.IsLeft = true;
base.Expression = expression.Left;
base.Start();
@ -19,7 +20,6 @@ namespace SqlSugar
base.Expression = expression.Right;
base.Start();
base.IsLeft = null;
base.Continue();
}
}
}

8
SqlSugar/ExpressionsToSql/ResolveItems/LambdaExpressionResolve.cs

@ -14,10 +14,12 @@ namespace SqlSugar
if (expression.NodeType == ExpressionType.MemberAccess)
{
base.SqlWhere = "(" + ((MemberExpression)expression).Member.Name + "=1)";
base.IsFinished = true;
}
base.Expression = expression;
base.Continue();
else
{
base.Expression = expression;
base.Start();
}
}
}
}

19
SqlSugar/ExpressionsToSql/ResolveItems/MemberExpressionResolve.cs

@ -12,21 +12,12 @@ namespace SqlSugar
var expression = base.Expression as MemberExpression;
var isLeft = parameter.IsLeft;
var isSingle = parameter.Context.IsSingle;
string field = string.Empty;
field = isSingle ? expression.Member.Name : expression.Member.ToString();
base.IsFinished = true;
base.SqlWhere += string.Format(" {0} ", field);
if (isLeft == true)
string fieldName = string.Empty;
fieldName = isSingle ? expression.Member.Name : expression.Member.ToString();
parameter.BaseParameter.TempData.Add(ExpConst.FiledName, fieldName);
if (isLeft == null && base.SqlWhere == null)
{
base.SqlWhere += ExpTool.GetOperator(parameter.BaseExpression.NodeType);
}
else if (isLeft == false)
{
}
else
{
base.SqlWhere = fieldName;
}
}
}

1
SqlSugar/SqlSugar.csproj

@ -97,6 +97,7 @@
<Compile Include="Entities\ConnectionConfig.cs" />
<Compile Include="Entities\DbColumnInfo.cs" />
<Compile Include="Entities\DbTableInfo.cs" />
<Compile Include="ExpressionsToSql\BinaryExpressionInfo.cs" />
<Compile Include="ExpressionsToSql\SugarParameter.cs" />
<Compile Include="ExpressionsToSql\ExpressionParameter.cs" />
<Compile Include="Entities\JoinQueryInfo.cs" />

BIN
SqlSugar/bin/Debug/SqlSugar.dll

Binary file not shown.

BIN
SqlSugar/bin/Debug/SqlSugar.pdb

Binary file not shown.

BIN
SqlSugar/obj/Debug/SqlSugar.dll

Binary file not shown.

BIN
SqlSugar/obj/Debug/SqlSugar.pdb

Binary file not shown.
Loading…
Cancel
Save