mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-02-25 04:27:14 +08:00
Added 25 comprehensive test cases for Split Table Operations: ✅ Basic Split Table Tests (Tests 1-4): - Split by Year - Split by Month - Split by Day - Split by Week ✅ Query Operations (Tests 5-8): - Single table query - Multiple tables union - Date range queries - Where condition filtering ✅ Update Operations (Tests 9-11): - Single record update - Multiple records update - Cross-table updates ✅ Delete Operations (Tests 12-14): - Single record delete - Date range delete - Entire table delete ✅ Advanced Features (Tests 15-18): - Get split table list - Auto table generation - Custom split field - Paginated queries across tables ✅ Bulk Operations (Tests 19-20): - Bulk insert across multiple tables - Bulk update across multiple tables ✅ Edge Cases (Tests 21-25): - Empty table queries - Future date inserts - Historical data queries - Auto-create non-existent tables - Performance with large datasets (1000 records) Test entities: - OrderByYear (Year-based partitioning) - LogByMonth (Month-based partitioning) - EventByDay (Day-based partitioning) - TaskByWeek (Week-based partitioning) All tests include: - Date-based table partitioning - CRUD operations across split tables - Performance metrics - Validation assertions - Console output tracking
68 lines
1.9 KiB
C#
68 lines
1.9 KiB
C#
using SqlSugar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace OrmTest
|
|
{
|
|
public partial class NewUnitTest
|
|
{
|
|
public static SqlSugarClient Db=> new SqlSugarClient(new ConnectionConfig()
|
|
{
|
|
DbType = DbType.MySql,
|
|
ConnectionString = Config.ConnectionString,
|
|
InitKeyType = InitKeyType.Attribute,
|
|
IsAutoCloseConnection = true,
|
|
AopEvents = new AopEvents
|
|
{
|
|
OnLogExecuting = (sql, p) =>
|
|
{
|
|
Console.WriteLine(sql);
|
|
Console.WriteLine(string.Join(",", p?.Select(it => it.ParameterName + ":" + it.Value)));
|
|
}
|
|
}
|
|
});
|
|
|
|
public static void RestData()
|
|
{
|
|
Db.DbMaintenance.TruncateTable<Order>();
|
|
Db.DbMaintenance.TruncateTable<OrderItem>();
|
|
}
|
|
public static void Init()
|
|
{
|
|
Unitdafasyfasfa.Init();
|
|
Unitdfaysfa.Init();
|
|
Unitsdfasfasa.Init();
|
|
Unitdfsdyss.Init();
|
|
Unitadfasfafays.Init();
|
|
Unitadfa12.Init();
|
|
Unitsdfa1231.Init();
|
|
Unitadfad1.Init();
|
|
UnitWeek.Init();
|
|
UnitTest.Init();
|
|
Unitdfasfasfa.Init();
|
|
UnitAddRemark.Init();
|
|
UnitSplitTask.Init();
|
|
UnitBulkMerge.Init();
|
|
UnitUpdateNavOneToOneFalse.Init();
|
|
UnitCreateType.Init();
|
|
UnitSubToList.Init();
|
|
UStorageable.Init();
|
|
UFastest.Init();
|
|
UNavigationProperties.Init();
|
|
USplitTable.Init();
|
|
Bulk();
|
|
CodeFirst();
|
|
Updateable();
|
|
Json();
|
|
Ado();
|
|
Queryable();
|
|
QueryableAsync();
|
|
Thread();
|
|
Thread2();
|
|
Thread3();
|
|
}
|
|
}
|
|
}
|