From 33bc22d1112ed0590c6e8df962ee56a6b0a69b80 Mon Sep 17 00:00:00 2001 From: sunkaixuna <610262374@qq.com> Date: Sun, 5 Sep 2021 11:29:26 +0800 Subject: [PATCH] Update Oscar --- .../SqlSeverTest/OscarTest/Config.cs | 6 +++--- .../SugarProvider/SqlSugarAccessory.cs | 3 +++ .../Infrastructure/DependencyManagement.cs | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/Src/Asp.NetCore2/SqlSeverTest/OscarTest/Config.cs b/Src/Asp.NetCore2/SqlSeverTest/OscarTest/Config.cs index c8c29c8d8..b68f7ae16 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/OscarTest/Config.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/OscarTest/Config.cs @@ -16,16 +16,16 @@ namespace OrmTest /// Account have permission to create database /// 用有建库权限的数据库账号 /// - public static string ConnectionString = "PORT=5432;DATABASE=SqlSugar4xTest;HOST=localhost;PASSWORD=haosql;USER ID=postgres"; + public static string ConnectionString = "PORT=2003;DATABASE=SqlSugar4xTest;HOST=localhost;PASSWORD=szoscar55;USER ID=SYSDBA"; /// /// Account have permission to create database /// 用有建库权限的数据库账号 /// - public static string ConnectionString2 = "PORT=5432;DATABASE=SqlSugar4xTest2;HOST=localhost;PASSWORD=haosql;USER ID=postgres"; + public static string ConnectionString2 = "PORT=2003;DATABASE=SqlSugar4xTest2;HOST=localhost;PASSWORD=szoscar55;USER ID=SYSDBA"; /// /// Account have permission to create database /// 用有建库权限的数据库账号 /// - public static string ConnectionString3 = "PORT=5432;DATABASE=SqlSugar4xTest3;HOST=localhost;PASSWORD=haosql;USER ID=postgres"; + public static string ConnectionString3 = "PORT=2003;DATABASE=SqlSugar4xTest3;HOST=localhost;PASSWORD=szoscar55;USER ID=SYSDBA"; } } diff --git a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs index 7bae8f62d..3decc9355 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs @@ -374,6 +374,9 @@ namespace SqlSugar case DbType.Dm: DependencyManagement.TryDm(); break; + case DbType.Oscar: + DependencyManagement.TryOscar(); + break; default: throw new Exception("ConnectionConfig.DbType is null"); } diff --git a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Infrastructure/DependencyManagement.cs b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Infrastructure/DependencyManagement.cs index 8ccda318b..e945e567a 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Infrastructure/DependencyManagement.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Infrastructure/DependencyManagement.cs @@ -15,6 +15,7 @@ namespace SqlSugar private static bool IsTryPgSql = false; private static bool IsTryDm = false; private static bool IsTryKd = false; + private static bool IsTryOscar = false; public static void TryJsonNet() { if (!IsTryJsonNet) @@ -149,5 +150,23 @@ namespace SqlSugar } } } + + public static void TryOscar() + { + if (!IsTryOscar) + { + try + { + OscarProvider db = new OscarProvider(); + var conn = db.GetAdapter(); + IsTryOscar = true; + } + catch (Exception ex) + { + var message = "需要引用Oscar.Data.SqlClient.dll,Github搜索sqlsugar源码里面有"; + throw new Exception(message); + } + } + } } } \ No newline at end of file