From 4f26c471a6df393e1a3e7b238c9259d4c7e1c3b0 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Fri, 5 May 2023 22:16:31 +0800 Subject: [PATCH] Add unit test --- .../OracleTest/Demo/DemoE_CodeFirst.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Src/Asp.NetCore2/OracleTest/Demo/DemoE_CodeFirst.cs b/Src/Asp.NetCore2/OracleTest/Demo/DemoE_CodeFirst.cs index 7093b33a9..8fc52a420 100644 --- a/Src/Asp.NetCore2/OracleTest/Demo/DemoE_CodeFirst.cs +++ b/Src/Asp.NetCore2/OracleTest/Demo/DemoE_CodeFirst.cs @@ -1,4 +1,5 @@ using SqlSugar; +using SqlSugar.DbConvert; using System; using System.Collections.Generic; using System.Linq; @@ -19,13 +20,26 @@ namespace OrmTest InitKeyType = InitKeyType.Attribute, IsAutoCloseConnection = true }); + db.Aop.OnLogExecuting = (s, p) => Console.WriteLine(UtilMethods.GetNativeSql(s,p)); db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1 db.Insertable(new CodeFirstTable1() { Name = "a", Text="a" }).ExecuteCommand(); var list = db.Queryable().ToList(); + db.CodeFirst.InitTables(); + db.Updateable(new List() { new CodeFirstTable22() { Name = "a" } }) + .ExecuteCommand(); + db.Insertable(new List() { new CodeFirstTable22() { Name = "a" }, new CodeFirstTable22() { Name = "a" } }) + .ExecuteCommand(); + var list2=db.Queryable().ToList(); Console.WriteLine("#### CodeFirst end ####"); } } - + public class CodeFirstTable22 + { + [SugarColumn(OracleSequenceName = "SEQ_ID", IsPrimaryKey = true)] + public int Id { get; set; } + [SugarColumn(ColumnDataType ="nvarchar2",Length =200, SqlParameterDbType =typeof(Nvarchar2PropertyConvert) )] + public string Name { get; set; } + } public class CodeFirstTable1 { [SugarColumn(OracleSequenceName ="SEQ_ID", IsPrimaryKey = true)]