diff --git a/Src/Asp.NetCore2/KdbndpNuget/Kdbndp.dll b/Src/Asp.NetCore2/KdbndpNuget/Kdbndp.dll index d2d773b71..3d2a80b05 100644 Binary files a/Src/Asp.NetCore2/KdbndpNuget/Kdbndp.dll and b/Src/Asp.NetCore2/KdbndpNuget/Kdbndp.dll differ diff --git a/Src/Asp.NetCore2/KdbndpNuget/SqlSugarForCore.nuspec b/Src/Asp.NetCore2/KdbndpNuget/SqlSugarForCore.nuspec index 7cb717d4d..8214bbe31 100644 --- a/Src/Asp.NetCore2/KdbndpNuget/SqlSugarForCore.nuspec +++ b/Src/Asp.NetCore2/KdbndpNuget/SqlSugarForCore.nuspec @@ -2,7 +2,7 @@ SqlSugarCore.Kdbndp - 9.3.6.412 + 9.3.6.618 sunkaixuan 果糖大数据科技 http://www.apache.org/licenses/LICENSE-2.0.html diff --git a/Src/Asp.NetCore2/KdbndpTest/KdbndpTest.csproj b/Src/Asp.NetCore2/KdbndpTest/KdbndpTest.csproj index f53b3d27b..67e632d63 100644 --- a/Src/Asp.NetCore2/KdbndpTest/KdbndpTest.csproj +++ b/Src/Asp.NetCore2/KdbndpTest/KdbndpTest.csproj @@ -6,7 +6,7 @@ - + diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/Demo0_SqlSugarClient.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo0_SqlSugarClient.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/Demo/Demo0_SqlSugarClient.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo0_SqlSugarClient.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/Demo1_Queryable.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo1_Queryable.cs similarity index 99% rename from Src/Asp.NetCore2/KdbndpTest/Demo/Demo1_Queryable.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo1_Queryable.cs index e66acdb17..5e6bca134 100644 --- a/Src/Asp.NetCore2/KdbndpTest/Demo/Demo1_Queryable.cs +++ b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo1_Queryable.cs @@ -1,4 +1,6 @@ -using SqlSugar; +using Kdbndp; +using KdbndpTypes; +using SqlSugar; using System; using System.Collections.Generic; using System.Data; @@ -29,7 +31,7 @@ namespace OrmTest Console.WriteLine(""); Console.WriteLine("#### Examples Start ####"); var db = GetInstance(); - var dbTime = db.GetDate(); + var dbTime = db.GetDate(); var getAll = db.Queryable().ToList(); var getOrderBy = db.Queryable().OrderBy(it => it.Name,OrderByType.Desc).ToList(); var getOrderBy2 = db.Queryable().OrderBy(it => it.Id).OrderBy(it => it.Name, OrderByType.Desc).ToList(); diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/Demo2_Updateable.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo2_Updateable.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/Demo/Demo2_Updateable.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo2_Updateable.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/Demo3_Insertable.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo3_Insertable.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/Demo/Demo3_Insertable.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo3_Insertable.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/Demo4_Deleteable.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo4_Deleteable.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/Demo/Demo4_Deleteable.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo4_Deleteable.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/Demo5_SqlQueryable.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo5_SqlQueryable.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/Demo/Demo5_SqlQueryable.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo5_SqlQueryable.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/Demo6_Queue.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo6_Queue.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/Demo/Demo6_Queue.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo6_Queue.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/Demo7_Ado.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo7_Ado.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/Demo/Demo7_Ado.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo7_Ado.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/Demo8_Saveable.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo8_Saveable.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/Demo/Demo8_Saveable.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo8_Saveable.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/Demo9_EntityMain.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo9_EntityMain.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/Demo/Demo9_EntityMain.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/Demo9_EntityMain.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/DemoA_DbMain.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/DemoA_DbMain.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/Demo/DemoA_DbMain.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/DemoA_DbMain.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/DemoB_Aop.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/DemoB_Aop.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/Demo/DemoB_Aop.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/DemoB_Aop.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/DemoD_DbFirst.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/DemoD_DbFirst.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/Demo/DemoD_DbFirst.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/DemoD_DbFirst.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/DemoE_CodeFirst.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/DemoE_CodeFirst.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/Demo/DemoE_CodeFirst.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/DemoE_CodeFirst.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/DemoF_Utilities.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/DemoF_Utilities.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/Demo/DemoF_Utilities.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/DemoF_Utilities.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/DemoG_SimpleClient.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/DemoG_SimpleClient.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/Demo/DemoG_SimpleClient.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/DemoG_SimpleClient.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/Demo/Democ_GobalFilter.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/Democ_GobalFilter.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/Demo/Democ_GobalFilter.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/Democ_GobalFilter.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/OracleDemo/OracleDemo.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/OracleDemo.cs new file mode 100644 index 000000000..84f749e14 --- /dev/null +++ b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/OracleDemo.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using OrmTest; +namespace KdbndpTest.OracleDemo +{ + internal class OracleDemo + { + public static void Init() + { + + Demo0_SqlSugarClient.Init(); + Demo1_Queryable.Init(); + Demo2_Updateable.Init(); + Demo3_Insertable.Init(); + Demo4_Deleteable.Init(); + Demo5_SqlQueryable.Init(); + Demo6_Queue.Init(); + Demo7_Ado.Init(); + Demo8_Saveable.Init(); + Demo9_EntityMain.Init(); + DemoA_DbMain.Init(); + DemoB_Aop.Init(); + DemoC_GobalFilter.Init(); + DemoD_DbFirst.Init(); ; + DemoE_CodeFirst.Init(); + DemoF_Utilities.Init(); + DemoG_SimpleClient.Init(); + } + } +} diff --git a/Src/Asp.NetCore2/KdbndpTest/UnitTest/Main.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/Main.cs similarity index 95% rename from Src/Asp.NetCore2/KdbndpTest/UnitTest/Main.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/Main.cs index 4a1b4d625..90ba9b1c4 100644 --- a/Src/Asp.NetCore2/KdbndpTest/UnitTest/Main.cs +++ b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/Main.cs @@ -1,4 +1,5 @@ -using SqlSugar; +using KdbndpTest.OracleDemo.UnitTest; +using SqlSugar; using System; using System.Collections.Generic; using System.Linq; diff --git a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UAdo.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UAdo.cs similarity index 97% rename from Src/Asp.NetCore2/KdbndpTest/UnitTest/UAdo.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UAdo.cs index 49788f35a..ec42de96d 100644 --- a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UAdo.cs +++ b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UAdo.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using KdbndpTest.OracleDemo.UnitTest; namespace OrmTest { diff --git a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UBulkCopy.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UBulkCopy.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/UnitTest/UBulkCopy.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UBulkCopy.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UCodeFirst.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UCodeFirst.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/UnitTest/UCodeFirst.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UCodeFirst.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UInsert3.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UInsert3.cs similarity index 90% rename from Src/Asp.NetCore2/KdbndpTest/UnitTest/UInsert3.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UInsert3.cs index 47e83ccb8..5b35384b3 100644 --- a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UInsert3.cs +++ b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UInsert3.cs @@ -1,4 +1,5 @@ -using SqlSugar; +using OrmTest; +using SqlSugar; using System; using System.Collections.Generic; using System.Data.SqlTypes; @@ -7,7 +8,7 @@ using System.Security.Principal; using System.Text; using System.Threading.Tasks; -namespace OrmTest +namespace KdbndpTest.OracleDemo.UnitTest { internal class UInsert3 { @@ -71,10 +72,10 @@ namespace OrmTest /// public string Name { get; set; } public decimal Price { get; set; } - [SugarColumn(InsertServerTime =true,UpdateServerTime =true)] + [SugarColumn(InsertServerTime = true, UpdateServerTime = true)] public DateTime CreateTime { get; set; } [SugarColumn(IsNullable = true)] - public int CustomId { get; set; } + public int CustomId { get; set; } } public class ORDER @@ -86,7 +87,7 @@ namespace OrmTest /// public string Name { get; set; } public decimal Price { get; set; } - [SugarColumn(InsertSql = "'2020-1-1'",UpdateSql = "'2022-1-1'")] + [SugarColumn(InsertSql = "'2020-1-1'", UpdateSql = "'2022-1-1'")] public DateTime CreateTime { get; set; } [SugarColumn(IsNullable = true)] public int CustomId { get; set; } diff --git a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UJson.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UJson.cs similarity index 97% rename from Src/Asp.NetCore2/KdbndpTest/UnitTest/UJson.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UJson.cs index 211e8f306..436adace4 100644 --- a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UJson.cs +++ b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UJson.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using KdbndpTest.OracleDemo.UnitTest; namespace OrmTest { diff --git a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UQueryable.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UQueryable.cs similarity index 99% rename from Src/Asp.NetCore2/KdbndpTest/UnitTest/UQueryable.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UQueryable.cs index 9fdc0766d..75733ffe4 100644 --- a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UQueryable.cs +++ b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UQueryable.cs @@ -1,4 +1,5 @@ -using SqlSugar; +using KdbndpTest.OracleDemo.UnitTest; +using SqlSugar; using System; using System.Collections.Generic; using System.Linq; diff --git a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UQueryableAsync.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UQueryableAsync.cs similarity index 97% rename from Src/Asp.NetCore2/KdbndpTest/UnitTest/UQueryableAsync.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UQueryableAsync.cs index 7ebce71e8..0a4a214ae 100644 --- a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UQueryableAsync.cs +++ b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UQueryableAsync.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using KdbndpTest.OracleDemo.UnitTest; using SqlSugar; namespace OrmTest { diff --git a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UThread.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UThread.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/UnitTest/UThread.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UThread.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UThread2.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UThread2.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/UnitTest/UThread2.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UThread2.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UThread3.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UThread3.cs similarity index 100% rename from Src/Asp.NetCore2/KdbndpTest/UnitTest/UThread3.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UThread3.cs diff --git a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UValidate.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UValidate.cs similarity index 67% rename from Src/Asp.NetCore2/KdbndpTest/UnitTest/UValidate.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UValidate.cs index b64608ae0..0353ffb30 100644 --- a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UValidate.cs +++ b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UValidate.cs @@ -4,13 +4,13 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace OrmTest +namespace KdbndpTest.OracleDemo.UnitTest { public class UValidate { public static void Check(object a, object b, object name) { - if (a?.ToString()?.Replace(" ","").Trim().ToLower() != b?.ToString().Replace(" ", "")?.Trim().ToLower()) + if (a?.ToString()?.Replace(" ", "").Trim().ToLower() != b?.ToString().Replace(" ", "")?.Trim().ToLower()) { throw new Exception(name + " error"); } diff --git a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UnitDateTime.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UnitDateTime.cs similarity index 78% rename from Src/Asp.NetCore2/KdbndpTest/UnitTest/UnitDateTime.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UnitDateTime.cs index a7793a6ca..8e88efe15 100644 --- a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UnitDateTime.cs +++ b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UnitDateTime.cs @@ -1,15 +1,16 @@ -using SqlSugar; +using OrmTest; +using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace OrmTest +namespace KdbndpTest.OracleDemo.UnitTest { internal class UnitDateTime { - public static void Init() + public static void Init() { Console.WriteLine(""); Console.WriteLine("#### DateTime Start ####"); @@ -20,8 +21,9 @@ namespace OrmTest ConnectionString = Config.ConnectionString.Replace("59321", "59322"), InitKeyType = InitKeyType.Attribute, IsAutoCloseConnection = true, - MoreSettings=new ConnMoreSettings() { - DatabaseModel=DbType.MySql + MoreSettings = new ConnMoreSettings() + { + DatabaseModel = DbType.MySql }, AopEvents = new AopEvents { @@ -33,10 +35,10 @@ namespace OrmTest } }); - var dt=db.Ado.GetDataTable("show database_mode;"); + var dt = db.Ado.GetDataTable("show database_mode;"); var now = DateTime.Now; - var insertObj = new UnitOrderDateTest() { Id = 1, Name = "0",CreateTime= now }; + var insertObj = new UnitOrderDateTest() { Id = 1, Name = "0", CreateTime = now }; var insertObj2 = new List { new UnitOrderDateTest() { Id = 11, Name = "1ms",CreateTime=now.AddMilliseconds(1) }, @@ -52,7 +54,7 @@ namespace OrmTest var beginTime = now.AddMinutes(-2); var endTime = now.AddHours(1).AddMinutes(2); - var list=db.Queryable().Where(it => it.CreateTime >= beginTime + var list = db.Queryable().Where(it => it.CreateTime >= beginTime && it.CreateTime <= endTime) .ToList(); @@ -60,24 +62,24 @@ namespace OrmTest && it.CreateTime <= endTime) .ToSqlString(); - var list2=db.Ado.SqlQuery(sql); + var list2 = db.Ado.SqlQuery(sql); - if (list.Count() != 5 || list2.Count() != 5) + if (list.Count() != 5 || list2.Count() != 5) { throw new Exception("UnitDateTime Error"); } - Console.WriteLine("#### DateTime End ####"); + Console.WriteLine("#### DateTime End ####"); } public class UnitOrderDateTest { [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] public int Id { get; set; } - public string Name { get; set; } + public string Name { get; set; } [SugarColumn(IsNullable = true)] - public DateTime CreateTime { get; set; } + public DateTime CreateTime { get; set; } } } } diff --git a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UnitSplitTask.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UnitSplitTask.cs similarity index 79% rename from Src/Asp.NetCore2/KdbndpTest/UnitTest/UnitSplitTask.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UnitSplitTask.cs index 60c738aa7..8ae7f6d05 100644 --- a/Src/Asp.NetCore2/KdbndpTest/UnitTest/UnitSplitTask.cs +++ b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/UnitSplitTask.cs @@ -1,16 +1,17 @@ -using SqlSugar; +using OrmTest; +using SqlSugar; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; -namespace OrmTest +namespace KdbndpTest.OracleDemo.UnitTest { internal class UnitSplitTask { - public static void Init() + public static void Init() { - var client = NewUnitTest.Db; + var client = NewUnitTest.Db; Console.WriteLine("Hello, World!"); List tasks = new List() { @@ -19,14 +20,15 @@ namespace OrmTest CreateTask(client.CopyNew()) }; - Task.WhenAll(tasks).GetAwaiter().GetResult(); + Task.WhenAll(tasks).GetAwaiter().GetResult(); client.Deleteable(new SpitDemoModel()).SplitTable().ExecuteCommand(); } private static Task CreateTask(ISqlSugarClient client) { - return Task.Run(() => { + return Task.Run(() => + { client.Insertable(new SpitDemoModel()).SplitTable().ExecuteCommand(); }); } @@ -43,4 +45,4 @@ namespace OrmTest } } - + diff --git a/Src/Asp.NetCore2/KdbndpTest/UnitTest/Updateable.cs b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/Updateable.cs similarity index 99% rename from Src/Asp.NetCore2/KdbndpTest/UnitTest/Updateable.cs rename to Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/Updateable.cs index 7c0c91e2e..f0c432353 100644 --- a/Src/Asp.NetCore2/KdbndpTest/UnitTest/Updateable.cs +++ b/Src/Asp.NetCore2/KdbndpTest/OracleDemo/UnitTest/Updateable.cs @@ -1,4 +1,5 @@ -using SqlSugar; +using KdbndpTest.OracleDemo.UnitTest; +using SqlSugar; using System; using System.Collections.Generic; using System.Linq; diff --git a/Src/Asp.NetCore2/KdbndpTest/Program.cs b/Src/Asp.NetCore2/KdbndpTest/Program.cs index 72832d0a2..b1e4f2c56 100644 --- a/Src/Asp.NetCore2/KdbndpTest/Program.cs +++ b/Src/Asp.NetCore2/KdbndpTest/Program.cs @@ -1,4 +1,6 @@ -using System; +using KdbndpTest.OracleDemo; +using KdbndpTest.SqlServerDemo; +using System; namespace OrmTest { @@ -6,24 +8,12 @@ namespace OrmTest { static void Main(string[] args) { - //Demo - Demo0_SqlSugarClient.Init(); - Demo1_Queryable.Init(); - Demo2_Updateable.Init(); - Demo3_Insertable.Init(); - Demo4_Deleteable.Init(); - Demo5_SqlQueryable.Init(); - Demo6_Queue.Init(); - Demo7_Ado.Init(); - Demo8_Saveable.Init(); - Demo9_EntityMain.Init(); - DemoA_DbMain.Init(); - DemoB_Aop.Init(); - DemoC_GobalFilter.Init(); - DemoD_DbFirst.Init(); ; - DemoE_CodeFirst.Init(); - DemoF_Utilities.Init(); - DemoG_SimpleClient.Init(); + + //Oracle模式DEMO + OracleDemo.Init(); + + //SqlServer模式DEMO + SqlServer.Init(); //Unit test //NewUnitTest.Init(); diff --git a/Src/Asp.NetCore2/KdbndpTest/SqlServerDemo/SqlServer.cs b/Src/Asp.NetCore2/KdbndpTest/SqlServerDemo/SqlServer.cs new file mode 100644 index 000000000..a54fa252a --- /dev/null +++ b/Src/Asp.NetCore2/KdbndpTest/SqlServerDemo/SqlServer.cs @@ -0,0 +1,51 @@ +using OrmTest; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KdbndpTest.SqlServerDemo +{ + internal class SqlServer + { + public static void Init() + { + SqlSugarClient Db = new SqlSugarClient(new ConnectionConfig() + { + DbType = DbType.Kdbndp, + ConnectionString = "Server=211.95.20.236 ;Port=35052;UID=system;PWD=abc123;database=test222", + InitKeyType = InitKeyType.Attribute, + IsAutoCloseConnection = true, + MoreSettings=new ConnMoreSettings() { + DatabaseModel=DbType.SqlServer + } + }, db => { + db.Aop.OnLogExecuting = (sql, p) => + { + Console.WriteLine(sql); + Console.WriteLine(string.Join(",", p?.Select(it => it.ParameterName + ":" + it.Value))); + }; + }); + Db.DbMaintenance.CreateDatabase(); + + foreach (var item in Db.DbMaintenance.GetColumnInfosByTableName("order",false)) + { + Console.WriteLine($"{item.DbColumnName} DataType:{item.DataType} IsIdentity :{item.IsIdentity} IsPrimarykey :{item.IsPrimarykey} IsNullable: {item.IsNullable} Length:{item.Length} Scale:{item.Scale}"); + } + + var yyy = Db.Queryable().ToList(); + var xxx=Db.Ado.GetDataTable("select * from information_schema.columns where pg_catalog.UPPER(table_name)=pg_catalog.UPPER('ORDER')\r\n"); + + Db.CodeFirst.InitTables(); + Db.Insertable(new Order() + { + CreateTime=DateTime.Now, + CustomId=1, + Name="a", + Price=1 + }).ExecuteCommand(); + } + } +}