SqlSugar/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs

53 lines
1.3 KiB
C#
Raw Normal View History

2019-05-16 20:25:11 +08:00
using SqlSugar;
using System;
2019-05-07 09:12:38 +08:00
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OrmTest
{
public partial class NewUnitTest
{
2019-05-16 20:25:11 +08:00
public static SqlSugarClient Db=> new SqlSugarClient(new ConnectionConfig()
{
DbType = DbType.SqlServer,
ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
AopEvents = new AopEvents
{
OnLogExecuting = (sql, p) =>
{
Console.WriteLine(sql);
2019-05-16 22:16:55 +08:00
Console.WriteLine(string.Join(",", p?.Select(it => it.ParameterName + ":" + it.Value)));
2019-05-16 20:25:11 +08:00
}
}
});
2019-06-02 11:09:03 +08:00
public static void RestData()
{
Db.DbMaintenance.TruncateTable<Order>();
Db.DbMaintenance.TruncateTable<OrderItem>();
}
2019-05-07 09:12:38 +08:00
public static void Init()
{
2021-01-30 17:23:41 +08:00
Filter();
2021-01-28 21:09:15 +08:00
Insert();
Insert2();
2021-01-27 03:49:53 +08:00
Enum();
2021-01-16 16:28:15 +08:00
Tran();
2019-06-09 20:14:39 +08:00
Queue();
CodeFirst();
2019-05-21 12:41:18 +08:00
Updateable();
2019-05-16 20:25:11 +08:00
Json();
2019-05-19 11:36:49 +08:00
Ado();
2019-05-20 16:15:01 +08:00
Queryable();
Queryable2();
2019-05-19 18:10:12 +08:00
QueryableAsync();
2020-11-12 20:27:33 +08:00
//Thread();
//Thread2();
//Thread3();
2019-05-07 09:12:38 +08:00
}
}
}