mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-01 19:03:58 +08:00
-
This commit is contained in:
@@ -10,6 +10,8 @@ namespace SqlSugar
|
||||
protected Expression Expression { get; set; }
|
||||
public ExpressionContext Context { get; set; }
|
||||
public string SqlWhere { get; set; }
|
||||
public bool IsFinished { get; set; }
|
||||
|
||||
private BaseResolve()
|
||||
{
|
||||
|
||||
@@ -21,6 +23,7 @@ namespace SqlSugar
|
||||
|
||||
public BaseResolve Start()
|
||||
{
|
||||
this.IsFinished = false;
|
||||
Expression exp = this.Expression;
|
||||
if (exp is LambdaExpression)
|
||||
{
|
||||
@@ -60,5 +63,12 @@ namespace SqlSugar
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public void Continue()
|
||||
{
|
||||
if (!IsFinished)
|
||||
{
|
||||
this.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@ using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
namespace SqlSugar
|
||||
{
|
||||
public class BinaryExpressionResolve:BaseResolve
|
||||
public class BinaryExpressionResolve : BaseResolve
|
||||
{
|
||||
public BinaryExpressionResolve(Expression exp) : base(exp)
|
||||
{
|
||||
|
||||
base.Continue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,19 @@ using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
namespace SqlSugar
|
||||
{
|
||||
public class LambdaExpressionResolve: BaseResolve
|
||||
public class LambdaExpressionResolve : BaseResolve
|
||||
{
|
||||
public LambdaExpressionResolve(Expression exp) : base(exp)
|
||||
{
|
||||
|
||||
LambdaExpression lambda = exp as LambdaExpression;
|
||||
var expression = lambda.Body;
|
||||
if (expression.NodeType == ExpressionType.MemberAccess)
|
||||
{
|
||||
base.SqlWhere = "(" + ((MemberExpression)expression).Member.Name + "=1)";
|
||||
base.IsFinished = true;
|
||||
}
|
||||
base.Expression = expression;
|
||||
base.Continue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user