mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
-
This commit is contained in:
parent
60eff8e71e
commit
24b53f7435
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.
Binary file not shown.
14
SqlSugar/Entities/ExpressionParameter.cs
Normal file
14
SqlSugar/Entities/ExpressionParameter.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
namespace SqlSugar
|
||||||
|
{
|
||||||
|
public class ExpressionParameter
|
||||||
|
{
|
||||||
|
public Expression Expression { get; set; }
|
||||||
|
public SqlSugarClient DbContext { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -8,10 +8,13 @@ namespace SqlSugar
|
|||||||
public class BaseResolve
|
public class BaseResolve
|
||||||
{
|
{
|
||||||
protected Expression Expression { get; set; }
|
protected Expression Expression { get; set; }
|
||||||
|
protected Expression BaseExpression { get; set; }
|
||||||
public ExpressionContext Context { get; set; }
|
public ExpressionContext Context { get; set; }
|
||||||
public string SqlWhere { get; set; }
|
public string SqlWhere { get; set; }
|
||||||
public bool IsFinished { 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; }
|
||||||
private BaseResolve()
|
private BaseResolve()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -23,7 +26,9 @@ namespace SqlSugar
|
|||||||
|
|
||||||
public BaseResolve Start()
|
public BaseResolve Start()
|
||||||
{
|
{
|
||||||
|
this.Index++;
|
||||||
this.IsFinished = false;
|
this.IsFinished = false;
|
||||||
|
this.BaseExpression = null;
|
||||||
Expression exp = this.Expression;
|
Expression exp = this.Expression;
|
||||||
if (exp is LambdaExpression)
|
if (exp is LambdaExpression)
|
||||||
{
|
{
|
||||||
|
@ -9,6 +9,15 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public BinaryExpressionResolve(Expression exp) : base(exp)
|
public BinaryExpressionResolve(Expression exp) : base(exp)
|
||||||
{
|
{
|
||||||
|
var expression = this.Expression as BinaryExpression;
|
||||||
|
base.BaseExpression = expression;
|
||||||
|
base.IsLeft = true;
|
||||||
|
base.Expression = expression.Left;
|
||||||
|
base.Start();
|
||||||
|
base.IsLeft = false;
|
||||||
|
base.Expression = expression.Right;
|
||||||
|
base.Start();
|
||||||
|
base.IsLeft = null;
|
||||||
base.Continue();
|
base.Continue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,10 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public MemberExpressionResolve(Expression exp) : base(exp)
|
public MemberExpressionResolve(Expression exp) : base(exp)
|
||||||
{
|
{
|
||||||
|
var isLeft = this.IsLeft;
|
||||||
|
this.IsLeft = null;
|
||||||
|
var isSingle=base.Context.IsSingle;
|
||||||
|
var expression = exp as MemberExpression;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,20 +8,20 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public class ExpressionContext : ExpResolveAccessory
|
public class ExpressionContext : ExpResolveAccessory
|
||||||
{
|
{
|
||||||
private ResolveExpressType type { get; set; }
|
public ResolveExpressType Type { get; set; }
|
||||||
private Expression expression { get; set; }
|
public Expression Expression { get; set; }
|
||||||
private bool IsSingle { get { return this.type == ResolveExpressType.Single; } }
|
public bool IsSingle { get { return this.Type == ResolveExpressType.Single; } }
|
||||||
|
|
||||||
public ExpressionContext(Expression expression, ResolveExpressType type)
|
public ExpressionContext(Expression expression, ResolveExpressType type)
|
||||||
{
|
{
|
||||||
this.type = type;
|
this.Type = type;
|
||||||
this.expression = expression;
|
this.Expression = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetFiledName()
|
public string GetFiledName()
|
||||||
{
|
{
|
||||||
string reval = null;
|
string reval = null;
|
||||||
LambdaExpression lambda = this.expression as LambdaExpression;
|
LambdaExpression lambda = this.Expression as LambdaExpression;
|
||||||
var isConvet = lambda.Body.NodeType.IsIn(ExpressionType.Convert);
|
var isConvet = lambda.Body.NodeType.IsIn(ExpressionType.Convert);
|
||||||
var isMember = lambda.Body.NodeType.IsIn(ExpressionType.MemberAccess);
|
var isMember = lambda.Body.NodeType.IsIn(ExpressionType.MemberAccess);
|
||||||
if (!isConvet && !isMember)
|
if (!isConvet && !isMember)
|
||||||
@ -56,7 +56,7 @@ namespace SqlSugar
|
|||||||
|
|
||||||
public string GetWhere()
|
public string GetWhere()
|
||||||
{
|
{
|
||||||
BaseResolve resolve = new BaseResolve(this.expression);
|
BaseResolve resolve = new BaseResolve(this.Expression);
|
||||||
resolve.Context = this;
|
resolve.Context = this;
|
||||||
resolve.Start();
|
resolve.Start();
|
||||||
return resolve.SqlWhere;
|
return resolve.SqlWhere;
|
||||||
@ -75,5 +75,7 @@ namespace SqlSugar
|
|||||||
base._Parameters = value;
|
base._Parameters = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int Index { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,7 @@
|
|||||||
<Compile Include="Entities\ConnectionConfig.cs" />
|
<Compile Include="Entities\ConnectionConfig.cs" />
|
||||||
<Compile Include="Entities\DbColumnInfo.cs" />
|
<Compile Include="Entities\DbColumnInfo.cs" />
|
||||||
<Compile Include="Entities\DbTableInfo.cs" />
|
<Compile Include="Entities\DbTableInfo.cs" />
|
||||||
|
<Compile Include="Entities\ExpressionParameter.cs" />
|
||||||
<Compile Include="Entities\JoinQueryInfo.cs" />
|
<Compile Include="Entities\JoinQueryInfo.cs" />
|
||||||
<Compile Include="Entities\Mapping\MappingColumn.cs" />
|
<Compile Include="Entities\Mapping\MappingColumn.cs" />
|
||||||
<Compile Include="Entities\Mapping\MappingTable.cs" />
|
<Compile Include="Entities\Mapping\MappingTable.cs" />
|
||||||
@ -135,9 +136,6 @@
|
|||||||
<Compile Include="SqlSugarAccessory.cs" />
|
<Compile Include="SqlSugarAccessory.cs" />
|
||||||
<Compile Include="SqlSugarClient.cs" />
|
<Compile Include="SqlSugarClient.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<WCFMetadata Include="Service References\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Lib\Newtonsoft.Json.dll" />
|
<Content Include="Lib\Newtonsoft.Json.dll" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -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
|
||||||
|
BIN
SqlSugar/obj/Debug/SqlSugar.csprojResolveAssemblyReference.cache
Normal file
BIN
SqlSugar/obj/Debug/SqlSugar.csprojResolveAssemblyReference.cache
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user