tangxu
2024-01-09 ddc2780231ea76be74fadb7486401a3d0d17b101
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
namespace Yw.Health
{
    internal class ConfigHelper
    {
 
        /// <summary>
        /// 默认连接配置
        /// </summary>
        internal static ConnectionConfig DefaultConnectionConfig
        {
            get
            {
                //SnowFlakeSingle.WorkId = Settings.SqlSugar.SnowFlakeWorkId; 不同机器配置的唯一数字; // 单服务器不需要指定
                return new ConnectionConfig()
                {
                    DbType = SqlSugar.DbType.PostgreSQL,//数据库类型
                    ConnectionString = HealthParasHelper.Health.DataBase.ConnectString,
                    IsAutoCloseConnection = true,//是否自动关闭
                    MoreSettings = new ConnMoreSettings()
                    {
                        //PgSqlIsAutoToLower = false //数据库存在大写字段的 ,需要把这个设为false ,并且实体和字段名称要一样
                    },
                    AopEvents = new AopEvents
                    {
                        OnLogExecuting = (sql, p) =>
                        {
                            // Console.WriteLine(sql);
                        }
                    }
                };
            }
        }
 
        /// <summary>
        /// 记录连接配置
        /// </summary>
        internal static ConnectionConfig RecordConnectionConfig
        {
            get
            {
                //SnowFlakeSingle.WorkId = Settings.SqlSugar.SnowFlakeWorkId; 不同机器配置的唯一数字; // 单服务器不需要指定
                return new ConnectionConfig()
                {
                    DbType = SqlSugar.DbType.PostgreSQL,//数据库类型
                    ConnectionString = HealthParasHelper.Health.DataBase.RecordConnectString,
                    IsAutoCloseConnection = true,//是否自动关闭
                    MoreSettings = new ConnMoreSettings()
                    {
                        //PgSqlIsAutoToLower = false //数据库存在大写字段的 ,需要把这个设为false ,并且实体和字段名称要一样
                    },
                    AopEvents = new AopEvents
                    {
                        OnLogExecuting = (sql, p) =>
                        {
                            // Console.WriteLine(sql);
                        }
                    }
                };
            }
        }
 
 
        /// <summary>
        /// 缓存保持时间 (分钟)
        /// </summary>
        public static int CacheKeepTime
        {
            get
            {
                return MemoryCacheParasHelper.MemoryCache.KeepTime;
            }
        }
 
        /// <summary>
        /// 缓存随机时间 (秒)
        /// </summary>
        public static int CacheRandomTime
        {
            get
            {
                return RandomHelper.Random(0, MemoryCacheParasHelper.MemoryCache.RandomTime);
            }
        }
 
 
 
 
 
 
 
 
 
 
 
 
 
    }
}