mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 23:13:42 +08:00
-
This commit is contained in:
parent
844476808d
commit
38fccaeb84
@ -760,6 +760,24 @@ namespace OrmTest.UnitTest
|
||||
{
|
||||
new SugarParameter("@Const0",false)
|
||||
}, "IIF5 error");
|
||||
IIF6();
|
||||
}
|
||||
|
||||
private void IIF6()
|
||||
{
|
||||
var dt = DateTime.Now.Date;
|
||||
Expression <Func<DataTestInfo, bool>> exp = it => SqlFunc.IIF(dt == it.Datetime1,it.Datetime1, it.Datetime1) == dt;
|
||||
SqlServerExpressionContext expContext = new SqlServerExpressionContext();
|
||||
expContext.MappingColumns = new MappingColumnList();
|
||||
expContext.MappingColumns.Add("Datetime1", "Datetime2", "DataTestInfo");
|
||||
expContext.Resolve(exp, ResolveExpressType.WhereSingle);
|
||||
var value = expContext.Result.GetString();
|
||||
var pars = expContext.Parameters;
|
||||
base.Check(value, pars, "(( CASE WHEN ( @Datetime10 = [Datetime2] ) THEN [Datetime2] ELSE [Datetime2] END ) = @Const1 )", new List<SugarParameter>()
|
||||
{
|
||||
new SugarParameter("@Datetime10",dt),
|
||||
new SugarParameter("@Const1",dt)
|
||||
}, "IIF6 error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -252,6 +252,9 @@ namespace SqlSugar
|
||||
protected MethodCallExpressionArgs GetMethodCallArgs(ExpressionParameter parameter, Expression item)
|
||||
{
|
||||
var newContext = this.Context.GetCopyContext();
|
||||
newContext.MappingColumns = this.Context.MappingColumns;
|
||||
newContext.MappingTables = this.Context.MappingTables;
|
||||
newContext.IgnoreComumnList = this.Context.IgnoreComumnList;
|
||||
newContext.Resolve(item, this.Context.IsJoin ? ResolveExpressType.WhereMultiple : ResolveExpressType.WhereSingle);
|
||||
this.Context.Index = newContext.Index;
|
||||
this.Context.ParameterIndex = newContext.ParameterIndex;
|
||||
|
Loading…
Reference in New Issue
Block a user