From ff4c57630697e9e4345a7e1b2236b0533d5ab812 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Tue, 4 Jun 2019 20:07:51 +0800 Subject: [PATCH] Update Demo --- .../OracleTest/Demo/Demo5_SqlQueryable.cs | 6 +-- Src/Asp.Net/OracleTest/Demo/Demo6_Queue.cs | 37 +------------------ Src/Asp.Net/OracleTest/Demo/Demo7_Ado.cs | 10 ++--- .../OracleTest/Demo/DemoE_CodeFirst.cs | 3 +- .../OracleTest/Demo/DemoF_Utilities.cs | 2 +- 5 files changed, 11 insertions(+), 47 deletions(-) diff --git a/Src/Asp.Net/OracleTest/Demo/Demo5_SqlQueryable.cs b/Src/Asp.Net/OracleTest/Demo/Demo5_SqlQueryable.cs index fadd3d2a1..99111bc38 100644 --- a/Src/Asp.Net/OracleTest/Demo/Demo5_SqlQueryable.cs +++ b/Src/Asp.Net/OracleTest/Demo/Demo5_SqlQueryable.cs @@ -23,13 +23,13 @@ namespace OrmTest }); int total = 0; - var list = db.SqlQueryable("select * from [order]").ToPageList(1, 2, ref total); + var list = db.SqlQueryable("select * from \"ORDER\" ").ToPageList(1, 2, ref total); //by expression - var list2 = db.SqlQueryable("select * from [order]").Where(it => it.Id == 1).ToPageList(1, 2); + var list2 = db.SqlQueryable("select * from \"ORDER\"").Where(it => it.Id == 1).ToPageList(1, 2); //by sql - var list3 = db.SqlQueryable("select * from [order]").Where("id=@id", new { id = 1 }).ToPageList(1, 2); + var list3 = db.SqlQueryable("select * from \"ORDER\"").Where("id=@id", new { id = 1 }).ToPageList(1, 2); Console.WriteLine("#### SqlQueryable End ####"); } diff --git a/Src/Asp.Net/OracleTest/Demo/Demo6_Queue.cs b/Src/Asp.Net/OracleTest/Demo/Demo6_Queue.cs index 314279be9..72ef8d071 100644 --- a/Src/Asp.Net/OracleTest/Demo/Demo6_Queue.cs +++ b/Src/Asp.Net/OracleTest/Demo/Demo6_Queue.cs @@ -11,42 +11,7 @@ namespace OrmTest { public static void Init() { - Console.WriteLine(""); - Console.WriteLine("#### Queue Start ####"); - - SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() - { - DbType = DbType.Oracle, - ConnectionString = Config.ConnectionString, - InitKeyType = InitKeyType.Attribute, - IsAutoCloseConnection = true, - AopEvents = new AopEvents - { - OnLogExecuting = (sql, p) => - { - Console.WriteLine(sql); - Console.WriteLine(string.Join(",", p?.Select(it => it.ParameterName + ":" + it.Value))); - } - } - }); - db.Insertable(new Order() { Name = "a" }).AddQueue(); - db.Insertable(new Order() { Name = "b" }).AddQueue(); - db.SaveQueues(); - - - db.Insertable(new Order() { Name = "a" }).AddQueue(); - db.Insertable(new Order() { Name = "b" }).AddQueue(); - db.Insertable(new Order() { Name = "c" }).AddQueue(); - db.Insertable(new Order() { Name = "d" }).AddQueue(); - var ar = db.SaveQueuesAsync(); - ar.Wait(); - - db.Queryable().AddQueue(); - db.Queryable().AddQueue(); - db.AddQueue("select * from [Order] where id=@id", new { id = 10000 }); - var result2 = db.SaveQueues(); - - Console.WriteLine("#### Queue End ####"); + //NoSupport } } } diff --git a/Src/Asp.Net/OracleTest/Demo/Demo7_Ado.cs b/Src/Asp.Net/OracleTest/Demo/Demo7_Ado.cs index be5533187..8d7b1f4bc 100644 --- a/Src/Asp.Net/OracleTest/Demo/Demo7_Ado.cs +++ b/Src/Asp.Net/OracleTest/Demo/Demo7_Ado.cs @@ -30,13 +30,13 @@ namespace OrmTest } }); //sql - var dt = db.Ado.GetDataTable("select * from [order] where @id>0 or name=@name", new List(){ + var dt = db.Ado.GetDataTable("select * from \"ORDER\" where @id>0 or name=@name", new List(){ new SugarParameter("@id",1), new SugarParameter("@name","2") }); //sql - var dt2 = db.Ado.GetDataTable("select * from [order] where @id>0 or name=@name", new { id = 1, name = "2" }); + var dt2 = db.Ado.GetDataTable("select * from \"ORDER\" where @id>0 or name=@name", new { id = 1, name = "2" }); //Stored Procedure //var dt3 = db.Ado.UseStoredProcedure().GetDataTable("sp_school", new { name = "张三", age = 0 }); @@ -47,9 +47,9 @@ namespace OrmTest //There are many methods to under db.ado - var list= db.Ado.SqlQuery("select * from [order] "); - var intValue=db.Ado.SqlQuerySingle("select 1"); - db.Ado.ExecuteCommand("delete [order] where id>1000"); + var list= db.Ado.SqlQuery("select * from \"ORDER\""); + var intValue=db.Ado.SqlQuerySingle("select 1 from dual"); + db.Ado.ExecuteCommand("delete \"ORDER\" where id>1000"); //db.Ado.xxx Console.WriteLine("#### Ado End ####"); } diff --git a/Src/Asp.Net/OracleTest/Demo/DemoE_CodeFirst.cs b/Src/Asp.Net/OracleTest/Demo/DemoE_CodeFirst.cs index a73dbfd3e..7093b33a9 100644 --- a/Src/Asp.Net/OracleTest/Demo/DemoE_CodeFirst.cs +++ b/Src/Asp.Net/OracleTest/Demo/DemoE_CodeFirst.cs @@ -28,10 +28,9 @@ namespace OrmTest public class CodeFirstTable1 { - [SugarColumn(IsIdentity = true, IsPrimaryKey = true)] + [SugarColumn(OracleSequenceName ="SEQ_ID", IsPrimaryKey = true)] public int Id { get; set; } public string Name { get; set; } - [SugarColumn(ColumnDataType = "Nvarchar(255)")]//custom public string Text { get; set; } [SugarColumn(IsNullable = true)] public DateTime CreateTime { get; set; } diff --git a/Src/Asp.Net/OracleTest/Demo/DemoF_Utilities.cs b/Src/Asp.Net/OracleTest/Demo/DemoF_Utilities.cs index 11706e7af..434c1fc33 100644 --- a/Src/Asp.Net/OracleTest/Demo/DemoF_Utilities.cs +++ b/Src/Asp.Net/OracleTest/Demo/DemoF_Utilities.cs @@ -37,7 +37,7 @@ namespace OrmTest Console.WriteLine(string.Join("," ,list)); }); - var list2= db.Utilities.DataTableToList(db.Ado.GetDataTable("select * from [order]")); + var list2= db.Utilities.DataTableToList(db.Ado.GetDataTable("select * from \"ORDER\"")); //more https://github.com/sunkaixuan/SqlSugar/wiki/f.Utilities Console.WriteLine("#### Utilities End ####");