mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
-
This commit is contained in:
parent
e9f883fa1b
commit
40340b8f32
@ -36,6 +36,8 @@ namespace OrmTest.Demo
|
||||
|
||||
var getAll7 = db.Queryable<Student>().Where(it => SqlFunc.Subqueryable<School>().Where(s => s.Id == it.Id).Any()).ToList();
|
||||
|
||||
var getAll9 = db.Queryable<Student>().Where(it => SqlFunc.Subqueryable<School>().Where(s => s.Id == it.Id).Count()==1).ToList();
|
||||
|
||||
var getAll8= db.Queryable<Student>().Where(it => SqlFunc.Subqueryable<School>().Where(s => s.Id == it.Id).Where(s=>s.Name==it.Name).NotAny()).ToList();
|
||||
|
||||
var getAll1 = db.Queryable<Student>().Where(it => it.Id == SqlFunc.Subqueryable<School>().Where(s => s.Id == it.Id).Select(s => s.Id)).ToList();
|
||||
|
@ -13,6 +13,5 @@ namespace SqlSugar
|
||||
string GetValue(Expression expression);
|
||||
int Sort { get; }
|
||||
Expression Expression { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
|
||||
namespace SqlSugar
|
||||
{
|
||||
public class SubCount: ISubOperation
|
||||
{
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Count";
|
||||
}
|
||||
}
|
||||
|
||||
public Expression Expression
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
|
||||
public int Sort
|
||||
{
|
||||
get
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
|
||||
public ExpressionContext Context
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string GetValue(Expression expression)
|
||||
{
|
||||
return "COUNT(*)";
|
||||
}
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@ namespace SqlSugar
|
||||
this.context = context;
|
||||
var currentExpression = expression;
|
||||
allMethods.Add(currentExpression);
|
||||
if (context.IsSingle && oppsiteExpression != null)
|
||||
if (context.IsSingle && oppsiteExpression != null&& oppsiteExpression is MemberExpression)
|
||||
{
|
||||
var childExpression = (oppsiteExpression as MemberExpression).Expression;
|
||||
this.context.SingleTableNameSubqueryShortName = (childExpression as ParameterExpression).Name;
|
||||
|
@ -19,7 +19,8 @@ namespace SqlSugar
|
||||
new SubAny(){ Context=Context },
|
||||
new SubNotAny(){ Context=Context },
|
||||
new SubBegin(){ Context=Context },
|
||||
new SubFromTable(){ Context=Context }
|
||||
new SubFromTable(){ Context=Context },
|
||||
new SubCount(){ Context=Context }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -36,9 +36,9 @@ namespace SqlSugar
|
||||
return default(bool);
|
||||
}
|
||||
|
||||
public bool Count()
|
||||
public int Count()
|
||||
{
|
||||
return default(bool);
|
||||
return default(int);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,8 +72,9 @@
|
||||
<Compile Include="Abstract\InsertableProvider\InsertableProvider.cs" />
|
||||
<Compile Include="Abstract\DeleteProvider\DeleteableProvider.cs" />
|
||||
<Compile Include="Enum\DbType.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\Items\ISubAction.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\Items\ISubOperation.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubAnd.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubCount.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubLeftBracket.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubFromTable.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\Items\SubAny.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user