using SqlSugar; using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Web; namespace Web.Code.DA... ...
using SqlSugar; using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Web; namespace Web.Code.DAL { public static class SqlSugarClientHelper { public static string ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; public static SqlSugarClient SqlDBConnection { get => new SqlSugarClient(new ConnectionConfig() { ConnectionString = ConnectionString,//必填, 資料庫連接字元串 DbType = SqlSugar.DbType.SqlServer, //必填, 資料庫類型 IsAutoCloseConnection = true, //預設false, 不自動關閉資料庫連接。設置為true無需使用using或者Close操作,自動釋放。 InitKeyType = InitKeyType.SystemTable //預設SystemTable, 欄位信息讀取, 如:該屬性是不是主鍵,是不是標識列等等信息 }); } } }