From eca49860545a566e1716498b63d76eabb4efaca2 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Sun, 2 Jun 2019 16:38:16 +0800 Subject: [PATCH] Update demo --- .../SqlServerTest/Demo/Demo9_EntityMain.cs | 22 ++++++++++++++++++- .../SqlServerTest/Demo/DemoA_DbMain.cs | 22 ++++++++++++++++++- Src/Asp.Net/SqlServerTest/Demo/DemoB_Aop.cs | 22 ++++++++++++++++++- .../SqlServerTest/Demo/DemoF_Utilities.cs | 22 ++++++++++++++++++- .../SqlServerTest/Demo/DemoG_SimpleClient.cs | 22 ++++++++++++++++++- 5 files changed, 105 insertions(+), 5 deletions(-) diff --git a/Src/Asp.Net/SqlServerTest/Demo/Demo9_EntityMain.cs b/Src/Asp.Net/SqlServerTest/Demo/Demo9_EntityMain.cs index 0e6df75bd..11ec8f3a1 100644 --- a/Src/Asp.Net/SqlServerTest/Demo/Demo9_EntityMain.cs +++ b/Src/Asp.Net/SqlServerTest/Demo/Demo9_EntityMain.cs @@ -1,4 +1,5 @@ -using System; +using SqlSugar; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -10,7 +11,26 @@ namespace OrmTest { public static void Init() { + Console.WriteLine(""); + Console.WriteLine("#### EntityMain Start ####"); + SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() + { + DbType = DbType.SqlServer, + 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))); + } + } + }); + + Console.WriteLine("#### EntityMain End ####"); } } } diff --git a/Src/Asp.Net/SqlServerTest/Demo/DemoA_DbMain.cs b/Src/Asp.Net/SqlServerTest/Demo/DemoA_DbMain.cs index ee0ea5eac..1862bf910 100644 --- a/Src/Asp.Net/SqlServerTest/Demo/DemoA_DbMain.cs +++ b/Src/Asp.Net/SqlServerTest/Demo/DemoA_DbMain.cs @@ -1,4 +1,5 @@ -using System; +using SqlSugar; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -10,7 +11,26 @@ namespace OrmTest { public static void Init() { + Console.WriteLine(""); + Console.WriteLine("#### DbMain Start ####"); + SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() + { + DbType = DbType.SqlServer, + 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))); + } + } + }); + + Console.WriteLine("#### DbMain End ####"); } } } diff --git a/Src/Asp.Net/SqlServerTest/Demo/DemoB_Aop.cs b/Src/Asp.Net/SqlServerTest/Demo/DemoB_Aop.cs index bb4a70d31..6b4a017c3 100644 --- a/Src/Asp.Net/SqlServerTest/Demo/DemoB_Aop.cs +++ b/Src/Asp.Net/SqlServerTest/Demo/DemoB_Aop.cs @@ -1,4 +1,5 @@ -using System; +using SqlSugar; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -10,7 +11,26 @@ namespace OrmTest { public static void Init() { + Console.WriteLine(""); + Console.WriteLine("#### Aop Start ####"); + SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() + { + DbType = DbType.SqlServer, + 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))); + } + } + }); + + Console.WriteLine("#### Aop End ####"); } } } diff --git a/Src/Asp.Net/SqlServerTest/Demo/DemoF_Utilities.cs b/Src/Asp.Net/SqlServerTest/Demo/DemoF_Utilities.cs index e4ecfadbc..3f02ba33f 100644 --- a/Src/Asp.Net/SqlServerTest/Demo/DemoF_Utilities.cs +++ b/Src/Asp.Net/SqlServerTest/Demo/DemoF_Utilities.cs @@ -1,4 +1,5 @@ -using System; +using SqlSugar; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -10,7 +11,26 @@ namespace OrmTest { public static void Init() { + Console.WriteLine(""); + Console.WriteLine("#### Utilities Start ####"); + SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() + { + DbType = DbType.SqlServer, + 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))); + } + } + }); + + Console.WriteLine("#### Utilities End ####"); } } } diff --git a/Src/Asp.Net/SqlServerTest/Demo/DemoG_SimpleClient.cs b/Src/Asp.Net/SqlServerTest/Demo/DemoG_SimpleClient.cs index dad9ea262..21b7208e8 100644 --- a/Src/Asp.Net/SqlServerTest/Demo/DemoG_SimpleClient.cs +++ b/Src/Asp.Net/SqlServerTest/Demo/DemoG_SimpleClient.cs @@ -1,4 +1,5 @@ -using System; +using SqlSugar; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -10,7 +11,26 @@ namespace OrmTest { public static void Init() { + Console.WriteLine(""); + Console.WriteLine("#### SimpleClient Start ####"); + SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() + { + DbType = DbType.SqlServer, + 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))); + } + } + }); + + Console.WriteLine("#### SimpleClient End ####"); } } }