Update exp to sql

This commit is contained in:
sunkaixuan
2019-04-15 21:54:42 +08:00
parent 03fc0cd9f8
commit 33e3838528
2 changed files with 5 additions and 0 deletions

View File

@@ -452,6 +452,7 @@ namespace OrmTest.Demo
var test50 = db.Queryable<Student>().Where(it => it.CreateTime != null).Where(it => SqlFunc.ToDate(it.CreateTime).Year == SqlFunc.GetDate().Year).ToList();
var test51 = db.Queryable<Student>().Select(it=>new { x= SqlFunc.ToDate(it.CreateTime).Year+"-" }).ToList();
var test52 = db.Queryable<Student>().Select(it => SqlFunc.IsNull(it.CreateTime, SqlFunc.GetDate())).ToList();
var test53 = db.Queryable<Student>().Select(it => SqlFunc.IsNull(it.CreateTime, SqlFunc.GetDate())).First();
}
public static void Page()
{

View File

@@ -407,6 +407,10 @@ namespace SqlSugar
}
else
{
if (expression is LambdaExpression && (expression as LambdaExpression).Body is MethodCallExpression&&this.Context.CurrentConnectionConfig.DbType==DbType.SqlServer&&this.OrderByValue.HasValue())
{
result = result + " AS columnName";
}
this.SelectCacheKey = result;
return result;
}