|
12345678910111213141516171819202122232425262728 |
- using SqlSugar;
- using System;
- using System.Linq;
-
- namespace DataVApi.Order
- {
- public class SugarDb
- {
-
- public static string Conn { get; set; }
-
- public SqlSugarScope DbContext()
- {
- SqlSugarScope client = new SqlSugarScope(new ConnectionConfig
- {
- ConnectionString = Conn,
- DbType = DbType.SqlServer,
- InitKeyType = InitKeyType.Attribute,
- IsAutoCloseConnection = true
- });
- client.Aop.OnLogExecuting = (sql, pars) =>
- {
- Console.WriteLine($"当前SQL语句:【{sql}】,参数:【{string.Join(",", pars.Select(t => t.Value))}】");
- };
- return client;
- }
- }
- }
|