Support split table

This commit is contained in:
sunkaixuna
2021-10-20 13:59:50 +08:00
parent e67d1a88ce
commit 859e7d34d4
13 changed files with 164 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class DemoN_SplitTable
{
public static void Init()
{
Console.WriteLine("");
Console.WriteLine("#### CodeFirst Start ####");
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{
DbType = DbType.SqlServer,
ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true
});
db.CodeFirst.SplitTables().InitTables<OrderSpliteTest>();
db.Queryable<OrderSpliteTest>().SplitTable(it => it.Take(3)).ToList();
Console.WriteLine("#### CodeFirst end ####");
}
[SqlSugar.SugarTable("Order{year}{month}{day}")]
public class OrderSpliteTest
{
[SugarColumn(IsPrimaryKey =true)]
public Guid Pk{ get; set; }
public string Name { get; set; }
}
}
}