From b58a871d74248ea989a4a5f17c349c1211d71883 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Mon, 6 Nov 2023 15:25:14 +0800 Subject: [PATCH] =?UTF-8?q?Add=20=E8=BE=BE=E6=A2=A6=20demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DmOrmTest/UnitTest/UBulkCopy.cs | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Src/Asp.NetCore2/DmOrmTest/UnitTest/UBulkCopy.cs diff --git a/Src/Asp.NetCore2/DmOrmTest/UnitTest/UBulkCopy.cs b/Src/Asp.NetCore2/DmOrmTest/UnitTest/UBulkCopy.cs new file mode 100644 index 000000000..dae749b29 --- /dev/null +++ b/Src/Asp.NetCore2/DmOrmTest/UnitTest/UBulkCopy.cs @@ -0,0 +1,66 @@ +using SqlSugar; +using SqlSugar.DbConvert; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace OrmTest +{ + public partial class NewUnitTest + { + public static void Bulk() + { + var db = NewUnitTest.Db; + db.DbMaintenance.DropTable(); + db.CodeFirst.InitTables(); + db.DbMaintenance.TruncateTable(); + db.Fastest().BulkCopy(new List() + { + new UnitBulkCopyaaa(){ a=DbType.GaussDB,Id=1 } + }); + db.Fastest().BulkUpdate(new List() + { + new UnitBulkCopyaaa(){ a=DbType.GaussDB,Id=1 } + }); + Console.WriteLine("用例跑完"); + } + + } + public class UnitBulkCopyaaa + { + [SugarColumn(IsPrimaryKey =true)] + public int Id { get; set; } + [SqlSugar.SugarColumn(ColumnDataType ="varchar(10)",SqlParameterDbType = typeof(EnumToStringConvert))] + public DbType a { get; set; } + } + public class UnitTestoffset11 + { + [SqlSugar.SugarColumn(IsNullable = true)] + public DateTimeOffset? DateTimeOffset { get; set; } + } + public class UnitTable001 + { + [SqlSugar.SugarColumn(IsPrimaryKey =true)] + public int Id { get; set; } + public string table { get; set; } + } + public class UnitIdentity111 + { + public int Id { get; set; } + public string Name { get; set; } + } + public class UnitIdentity111111111 + { + [SqlSugar.SugarColumn(IsPrimaryKey = true)] + public int Id { get; set; } + public string Name { get; set; } + } + + public class UnitIdentity1 + { + [SqlSugar.SugarColumn(IsPrimaryKey =true,IsIdentity =true)] + public int Id { get; set; } + public string Name { get; set; } + } +}