From f706b8a8391a54985f45b86020c590baea7b11b6 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Tue, 11 Mar 2025 18:04:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0DEMO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/Asp.NetCore2/DB2CoreTest/Program.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Src/Asp.NetCore2/DB2CoreTest/Program.cs b/Src/Asp.NetCore2/DB2CoreTest/Program.cs index ea4856e72..abeca1ee8 100644 --- a/Src/Asp.NetCore2/DB2CoreTest/Program.cs +++ b/Src/Asp.NetCore2/DB2CoreTest/Program.cs @@ -35,15 +35,18 @@ public class DbHelper /// /// SqlSugarClient instance public static SqlSugarClient GetNewDb() - { - InstanceFactory.CustomDbName = "DB2";//文件名前缀 - InstanceFactory.CustomDllName = "SqlSugar.DB2Core";//你扩展的dll名字 - InstanceFactory.CustomNamespace = "SqlSugar.DB2";//你扩展dll的命名空间 + { + //这行代码扔程序启动时 + InstanceFactory.CustomAssemblies = new System.Reflection.Assembly[] { + typeof(SqlSugar.DB2.DB2Provider).Assembly }; + + + //创建数据库 var db = new SqlSugarClient(new ConnectionConfig() { - IsAutoCloseConnection = true, - DbType = DbType.Custom, + IsAutoCloseConnection = true, + DbType=DbType.DB2, ConnectionString = Connection, InitKeyType = InitKeyType.Attribute, LanguageType = LanguageType.Default//Set language