From 64542acb2f64d1b0a93e568de5a094fbcd172882 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Sun, 14 Oct 2018 15:54:18 +0800 Subject: [PATCH] - --- Src/Asp.Net/SqlServerTest/Demos/1_Query.cs | 9 +++++++++ .../ExpressionsToSql/ResolveItems/BaseResolve.cs | 1 + 2 files changed, 10 insertions(+) diff --git a/Src/Asp.Net/SqlServerTest/Demos/1_Query.cs b/Src/Asp.Net/SqlServerTest/Demos/1_Query.cs index adb236d7f..1985fa315 100644 --- a/Src/Asp.Net/SqlServerTest/Demos/1_Query.cs +++ b/Src/Asp.Net/SqlServerTest/Demos/1_Query.cs @@ -41,6 +41,15 @@ namespace OrmTest.Demo { var db = GetInstance(); var i = 0; + + + var sumflat2num = db.Queryable((s1, s2) => + new object[] { JoinType.Left, s1.Id == s2.Id }) + + .Select((s1, s2) => new Student + { Id = SqlFunc.IsNull(SqlFunc.AggregateSum(SqlFunc.IIF(s1.Id ==1, s1.Id, s1.Id * -1)), 0) }) + .First(); + var getAll11 = db.Queryable().Where(it => SqlFunc.Subqueryable().Where(s => s.Id == it.Id).Max(s=>s.Id)==i).ToList(); var getAll12 = db.Queryable().Where(it => SqlFunc.Subqueryable().Where(s => s.Id == it.Id).Max(s => s.Id) == 1).ToList(); var getAll7 = db.Queryable().Where(it => SqlFunc.Subqueryable().Where(s => s.Id == it.Id).Any()).ToList(); diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs index 0dd846548..f4849ae58 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs @@ -256,6 +256,7 @@ namespace SqlSugar newContext.MappingColumns = this.Context.MappingColumns; newContext.MappingTables = this.Context.MappingTables; newContext.IgnoreComumnList = this.Context.IgnoreComumnList; + newContext.IsSingle = this.Context.IsSingle; newContext.SqlFuncServices = this.Context.SqlFuncServices; newContext.Resolve(item, this.Context.IsJoin ? ResolveExpressType.WhereMultiple : ResolveExpressType.WhereSingle); this.Context.Index = newContext.Index;