Browse Source

-

pull/12/MERGE
sunkaixuan 6 years ago
parent
commit
64542acb2f
  1. 9
      Src/Asp.Net/SqlServerTest/Demos/1_Query.cs
  2. 1
      Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs

9
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<Student, Student>((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<Student>().Where(it => SqlFunc.Subqueryable<School>().Where(s => s.Id == it.Id).Max(s=>s.Id)==i).ToList();
var getAll12 = db.Queryable<Student>().Where(it => SqlFunc.Subqueryable<School>().Where(s => s.Id == it.Id).Max(s => s.Id) == 1).ToList();
var getAll7 = db.Queryable<Student>().Where(it => SqlFunc.Subqueryable<School>().Where(s => s.Id == it.Id).Any()).ToList();

1
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;

Loading…
Cancel
Save