sunkaixuan
8 years ago
34 changed files with 127 additions and 141 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.
Binary file not shown.
@ -1,19 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Linq.Expressions; |
|||
using System.Text; |
|||
|
|||
namespace SqlSugar |
|||
{ |
|||
public class MemberExpressionResolve:BaseResolve |
|||
{ |
|||
public MemberExpressionResolve(Expression exp) : base(exp) |
|||
{ |
|||
var isLeft = this.IsLeft; |
|||
this.IsLeft = null; |
|||
var isSingle=base.Context.IsSingle; |
|||
var expression = exp as MemberExpression; |
|||
} |
|||
} |
|||
} |
@ -1,81 +0,0 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Data.SqlClient; |
|||
using System.Linq; |
|||
using System.Linq.Expressions; |
|||
using System.Text; |
|||
namespace SqlSugar |
|||
{ |
|||
public class ExpressionContext : ExpResolveAccessory |
|||
{ |
|||
public ResolveExpressType Type { get; set; } |
|||
public Expression Expression { get; set; } |
|||
public bool IsSingle { get { return this.Type == ResolveExpressType.Single; } } |
|||
|
|||
public ExpressionContext(Expression expression, ResolveExpressType type) |
|||
{ |
|||
this.Type = type; |
|||
this.Expression = expression; |
|||
} |
|||
|
|||
public string GetFiledName() |
|||
{ |
|||
string reval = null; |
|||
LambdaExpression lambda = this.Expression as LambdaExpression; |
|||
var isConvet = lambda.Body.NodeType.IsIn(ExpressionType.Convert); |
|||
var isMember = lambda.Body.NodeType.IsIn(ExpressionType.MemberAccess); |
|||
if (!isConvet && !isMember) |
|||
throw new SqlSugarException(ErrorMessage.ExpFileldError); |
|||
try |
|||
{ |
|||
if (isConvet && IsSingle) |
|||
{ |
|||
var memberExpr = ((UnaryExpression)lambda.Body).Operand as MemberExpression; |
|||
reval = memberExpr.Member.Name; |
|||
} |
|||
else if (!isConvet && IsSingle)//isMember
|
|||
{ |
|||
reval = (lambda.Body as MemberExpression).Member.Name; |
|||
} |
|||
else if (isConvet && !IsSingle) |
|||
{ |
|||
var memberExpr = ((UnaryExpression)lambda.Body).Operand as MemberExpression; |
|||
reval = memberExpr.ToString(); |
|||
} |
|||
else if (!isConvet && !IsSingle) |
|||
{ |
|||
reval = lambda.Body.ToString(); |
|||
} |
|||
} |
|||
catch |
|||
{ |
|||
throw new SqlSugarException(ErrorMessage.ExpFileldError); |
|||
} |
|||
return reval; |
|||
} |
|||
|
|||
public string GetWhere() |
|||
{ |
|||
BaseResolve resolve = new BaseResolve(this.Expression); |
|||
resolve.Context = this; |
|||
resolve.Start(); |
|||
return resolve.SqlWhere; |
|||
} |
|||
|
|||
public string GetSelect() { return ""; } |
|||
|
|||
public List<SqlParameter> Parameters |
|||
{ |
|||
get |
|||
{ |
|||
return PubMethod.IsNullReturnNew(base._Parameters); |
|||
} |
|||
set |
|||
{ |
|||
base._Parameters = value; |
|||
} |
|||
} |
|||
|
|||
public int Index { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,33 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Linq.Expressions; |
|||
using System.Text; |
|||
namespace SqlSugar |
|||
{ |
|||
public class MemberExpressionResolve : BaseResolve |
|||
{ |
|||
public MemberExpressionResolve(ExpressionParameter parameter) : base(parameter) |
|||
{ |
|||
var expression = base.Expression as MemberExpression; |
|||
var isLeft = this.IsLeft; |
|||
this.IsLeft = null; |
|||
var isSingle = base.Context.IsSingle; |
|||
string field = string.Empty; |
|||
field = isSingle ? expression.Member.Name : expression.Member.ToString(); |
|||
base.IsFinished = true; |
|||
if (IsLeft == true) |
|||
{ |
|||
base.SqlWhere += ExpTool.GetOperator(parameter.BaseExpression.NodeType); |
|||
} |
|||
else if (isLeft == false) |
|||
{ |
|||
|
|||
} |
|||
else |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,45 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Data.Common; |
|||
using System.Data.SqlClient; |
|||
using System.Linq; |
|||
using System.Linq.Expressions; |
|||
using System.Text; |
|||
namespace SqlSugar |
|||
{ |
|||
public class ExpressionContext : ExpResolveAccessory |
|||
{ |
|||
public ResolveExpressType Type { get; set; } |
|||
public Expression Expression { get; set; } |
|||
public bool IsSingle { get { return this.Type == ResolveExpressType.Single; } } |
|||
|
|||
public ExpressionContext(Expression expression, ResolveExpressType type) |
|||
{ |
|||
this.Type = type; |
|||
this.Expression = expression; |
|||
} |
|||
|
|||
public override string ToString() |
|||
{ |
|||
BaseResolve resolve = new BaseResolve(new ExpressionParameter() { Expression=this.Expression, Context=this }); |
|||
resolve.Start(); |
|||
return resolve.SqlWhere; |
|||
} |
|||
|
|||
public string GetSelect() { return ""; } |
|||
|
|||
public List<DbParameter> Parameters |
|||
{ |
|||
get |
|||
{ |
|||
return PubMethod.IsNullReturnNew(base._Parameters); |
|||
} |
|||
set |
|||
{ |
|||
base._Parameters = value; |
|||
} |
|||
} |
|||
|
|||
public int Index { get; set; } |
|||
} |
|||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue