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

46 lines
1.2 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()
{
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();
2019-05-19 18:10:12 +08:00
QueryableAsync();
2019-05-18 10:55:28 +08:00
Thread();
2019-05-19 09:14:04 +08:00
Thread2();
Thread3();
2019-05-07 09:12:38 +08:00
}
}
}