SqlSugar源码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.2 KiB

3 years ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
namespace OrmTest
{
public class UCustom03
{
public static void Init()
{
var db = NewUnitTest.Db;
db.Aop.OnLogExecuting = (sql, pars) =>
{
Console.WriteLine($"SqlSugar[Info]:{UtilMethods.GetSqlString(DbType.SqlServer, sql, pars) }");
};
//建表
2 years ago
if (!db.DbMaintenance.IsAnyTable("Test001111", false))
3 years ago
{
db.CodeFirst.InitTables<Test001111>();
}
//用例代码
var dt = DateTime.Now.Date;
var result = db.Insertable(new Test001111() { id = dt }).ExecuteCommand();//用例代码
var res = db.Queryable<Test001111>().WhereClass(new Test001111() { id = dt }).ToList();
//Console.WriteLine(result);
2 years ago
//Console.WriteLine("用例跑完");
//Console.ReadKey();
3 years ago
}
//建类
public class Test001111
{
[SqlSugar.SugarColumn(SqlParameterDbType = System.Data.DbType.Date)]
public DateTime? id { get; set; }
}
}
}