更新DEMO

This commit is contained in:
sunkaixuan 2025-03-11 18:04:40 +08:00
parent 597e02b35b
commit f706b8a839

View File

@ -35,15 +35,18 @@ public class DbHelper
/// </summary> /// </summary>
/// <returns>SqlSugarClient instance</returns> /// <returns>SqlSugarClient instance</returns>
public static SqlSugarClient GetNewDb() 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() var db = new SqlSugarClient(new ConnectionConfig()
{ {
IsAutoCloseConnection = true, IsAutoCloseConnection = true,
DbType = DbType.Custom, DbType=DbType.DB2,
ConnectionString = Connection, ConnectionString = Connection,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
LanguageType = LanguageType.Default//Set language LanguageType = LanguageType.Default//Set language