mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 21:56:03 +08:00
Add demo
This commit is contained in:
parent
dcf24d8645
commit
5392ac0d18
@ -8,9 +8,44 @@ namespace OrmTest
|
||||
{
|
||||
internal class _a3_Merge
|
||||
{
|
||||
// 中文备注:初始化方法(用于大数据处理)
|
||||
// English Comment: Initialization method (for big data processing)
|
||||
internal static void Init()
|
||||
{
|
||||
|
||||
var db = DbHelper.GetNewDb();
|
||||
//建表
|
||||
//Create table
|
||||
db.CodeFirst.InitTables<Order>();
|
||||
var list = new List<Order>() { new Order() { Name = "jack" } };
|
||||
|
||||
// 中文备注:执行插入或更新操作
|
||||
// English Comment: Perform insert or update operation
|
||||
db.Storageable(list).ExecuteCommand();
|
||||
|
||||
// 中文备注:分页执行插入或更新操作,每页1000条记录
|
||||
// English Comment: Perform insert or update operation with paging, 1000 records per page
|
||||
db.Storageable(list).PageSize(1000).ExecuteCommand();
|
||||
|
||||
// 中文备注:带异常处理的分页插入或更新操作,每页1000条记录
|
||||
// English Comment: Perform insert or update operation with exception handling and paging, 1000 records per page
|
||||
db.Storageable(list).PageSize(1000, exrows => { }).ExecuteCommand();
|
||||
|
||||
// 中文备注:使用Fastest方式批量合并数据(用于大数据处理)
|
||||
// English Comment: Merge data using Fastest method (for big data processing)
|
||||
db.Fastest<Order>().BulkMerge(list);
|
||||
|
||||
// 中文备注:分页使用Fastest方式批量合并数据,每页100000条记录(用于大数据处理)
|
||||
// English Comment: Merge data using Fastest method with paging, 100000 records per page (for big data processing)
|
||||
db.Fastest<Order>().PageSize(100000).BulkMerge(list);
|
||||
}
|
||||
|
||||
[SqlSugar.SugarTable("Order_a3")]
|
||||
public class Order
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey =true,IsIdentity =true)]
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
// 其他属性
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user