Browse Source

Update demo

pull/1/head
skx 4 years ago
parent
commit
05daf22025
  1. 12
      Src/Asp.Net/DmTest/Demo/Demo1_Queryable.cs
  2. 6
      Src/Asp.Net/MySqlTest/Demo/Demo1_Queryable.cs
  3. 9
      Src/Asp.Net/PgSqlTest/Demo/Demo1_Queryable.cs

12
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<Order>().Select(it => SqlFunc.CharIndex("a", "cccacc")).First();
var list2 = db.Queryable<Order>().Select(it => new
{
date = SqlFunc.ToDateShort(SqlFunc.GetDate()),
datetime = SqlFunc.GetDate()
}).ToList();
Console.WriteLine("#### SqlFunc End ####");
}

6
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<Order>().Select(it => SqlFunc.CharIndex("a", "cccacc")).First();
var list2 = db.Queryable<Order>().Select(it => new
{
date = SqlFunc.ToDateShort(it.CreateTime),
datetime = SqlFunc.ToDate(it.CreateTime)
}).ToList();
Console.WriteLine("#### SqlFunc End ####");
}

9
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<Order>().Select(it => SqlFunc.Contains("a", "cccacc")).First();
var list = db.Queryable<Order>().Select(it => new ViewOrder()
{
Id = SqlFunc.AggregateSum(SqlFunc.IF(it.Id > 0).Return(1).End(0))
}).ToList();
var list2 = db.Queryable<Order>().Select(it => new
{
date = SqlFunc.ToDateShort(it.CreateTime),
datetime = SqlFunc.ToDate(it.CreateTime)
}).ToList();
Console.WriteLine("#### SqlFunc End ####");
}

Loading…
Cancel
Save