private static void SqlFuncTest() { Console.WriteLine(""); Console.WriteLine("#### SqlFunc Start ####"); var db = GetInstance(); var index = db.Queryable <Order>().Select(it => SqlFunc.CharIndex("a", "cccacc")).First(); Console.WriteLine("#### SqlFunc End ####"); }
private static void SqlFuncTest() { Console.WriteLine(""); Console.WriteLine("#### SqlFunc Start ####"); var db = GetInstance(); var index = db.Queryable <Order>().Select(it => SqlFunc.CharIndex("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(); Console.WriteLine("#### SqlFunc End ####"); }
private static void SqlFuncTest() { Console.WriteLine(""); 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 ####"); }
private static void SqlFuncTest() { Console.WriteLine(""); Console.WriteLine("#### SqlFunc Start ####"); var db = GetInstance(); var index = db.Queryable <Order>().Select(it => SqlFunc.CharIndex("a", "cccacc")).First(); var dt = DateTime.Now.Date; var list2 = db.Queryable <Order>() .Where(it => SqlFunc.ToDateShort(it.CreateTime) == DateTime.Now.Date) .Select(it => new { date = SqlFunc.ToDateShort(it.CreateTime), datetime = it.CreateTime }) .ToList(); var list3 = db.Queryable <Order>().Where(it => it.CreateTime.Date == SqlFunc.Oracle_ToDate("2021-1-21", "yyyy-MM-dd")).ToList(); var list4 = db.Queryable <Order>().Select(it => SqlFunc.Oracle_ToChar(DateTime.Now, "yyyy-MM-dd")).ToList(); Console.WriteLine("#### SqlFunc End ####"); }
private static void SqlFuncTest() { 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 ####"); }