diff --git a/Src/Asp.Net/DmTest/Demo/Demo1_Queryable.cs b/Src/Asp.Net/DmTest/Demo/Demo1_Queryable.cs index d14fa8bf7..97166f04c 100644 --- a/Src/Asp.Net/DmTest/Demo/Demo1_Queryable.cs +++ b/Src/Asp.Net/DmTest/Demo/Demo1_Queryable.cs @@ -123,7 +123,19 @@ namespace OrmTest Console.WriteLine(""); Console.WriteLine("#### SqlFunc Start ####"); var db = GetInstance(); + db.Insertable(new Order() + { + CreateTime = DateTime.Now, + Name = "now", + CustomId = 1, + Price = 0 + }).ExecuteCommand(); var index= db.Queryable().Select(it => SqlFunc.CharIndex("a", "cccacc")).First(); + var list2 = db.Queryable().Select(it => new + { + date = SqlFunc.ToDateShort(SqlFunc.GetDate()), + datetime = SqlFunc.GetDate() + }).ToList(); Console.WriteLine("#### SqlFunc End ####"); } diff --git a/Src/Asp.Net/MySqlTest/Demo/Demo1_Queryable.cs b/Src/Asp.Net/MySqlTest/Demo/Demo1_Queryable.cs index 23d879b2d..c45380568 100644 --- a/Src/Asp.Net/MySqlTest/Demo/Demo1_Queryable.cs +++ b/Src/Asp.Net/MySqlTest/Demo/Demo1_Queryable.cs @@ -124,7 +124,11 @@ namespace OrmTest Console.WriteLine("#### SqlFunc Start ####"); var db = GetInstance(); var index= db.Queryable().Select(it => SqlFunc.CharIndex("a", "cccacc")).First(); - + var list2 = db.Queryable().Select(it => new + { + date = SqlFunc.ToDateShort(it.CreateTime), + datetime = SqlFunc.ToDate(it.CreateTime) + }).ToList(); Console.WriteLine("#### SqlFunc End ####"); } diff --git a/Src/Asp.Net/PgSqlTest/Demo/Demo1_Queryable.cs b/Src/Asp.Net/PgSqlTest/Demo/Demo1_Queryable.cs index 3113645c2..66ea8c0eb 100644 --- a/Src/Asp.Net/PgSqlTest/Demo/Demo1_Queryable.cs +++ b/Src/Asp.Net/PgSqlTest/Demo/Demo1_Queryable.cs @@ -124,7 +124,16 @@ namespace OrmTest Console.WriteLine("#### SqlFunc Start ####"); var db = GetInstance(); var index= db.Queryable().Select(it => SqlFunc.Contains("a", "cccacc")).First(); + var list = db.Queryable().Select(it => new ViewOrder() + { + Id = SqlFunc.AggregateSum(SqlFunc.IF(it.Id > 0).Return(1).End(0)) + }).ToList(); + var list2 = db.Queryable().Select(it => new + { + date = SqlFunc.ToDateShort(it.CreateTime), + datetime = SqlFunc.ToDate(it.CreateTime) + }).ToList(); Console.WriteLine("#### SqlFunc End ####"); }