using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using F9.DataEntity.Entity; using SqlSugar; namespace OrmTest { public class UBulkCopy { public static void Init() { var db = NewUnitTest.Db; db.DbMaintenance.CreateDatabase(); db.Aop.OnLogExecuting = null; db.CodeFirst.InitTables(); var list = new List(); db.DbMaintenance.TruncateTable(); for (int i = 0; i < 100000; i++) { list.Add(new UBulkCopydsafad1() { name = "a", name1 = "x" + i, name2 = "a" }); } // db.BeginTran(); // db.Insertable(list).ExecuteCommand(); var list2 = db.Queryable().ToList(); db.Fastest().BulkCopy(list); var list3 = db.Queryable().ToList(); var row= db.Fastest().BulkUpdate(list3); //db.CommitTran(); } public class UBulkCopydsafad1 { [SugarColumn(IsIdentity =true,IsPrimaryKey =true)] public int id { get; set; } public string name { get; set; } public string name1 { get; set; } public string name2 { get; set; } public int id2 { get; set; } public int id3 { get; set; } } } }