77using SqlSugar ;
88using Blog . Core . Common . Caches ;
99using System . Text . RegularExpressions ;
10+ using Blog . Core . Common . Option ;
1011using Blog . Core . Common . Utility ;
1112
1213namespace Blog . Core . Extensions
@@ -36,7 +37,7 @@ public static void AddSqlsugarSetup(this IServiceCollection services)
3637 {
3738 ConfigId = m . ConnId . ObjToString ( ) . ToLower ( ) ,
3839 ConnectionString = m . Connection ,
39- DbType = ( DbType ) m . DbType ,
40+ DbType = ( DbType ) m . DbType ,
4041 IsAutoCloseConnection = true ,
4142 // Check out more information: https://github.com/anjoy8/Blog.Core/issues/122
4243 //IsShardSameThread = false,
@@ -55,6 +56,8 @@ public static void AddSqlsugarSetup(this IServiceCollection services)
5556 // 自定义特性
5657 ConfigureExternalServices = new ConfigureExternalServices ( )
5758 {
59+ //不建议使用,性能有很大问题,会导致redis堆积
60+ //核心问题在于SqlSugar,每次query都会查缓存, insert\update\delete,又会频繁GetAllKey,导致性能特别低
5861 DataInfoCacheService = new SqlSugarCacheService ( ) ,
5962 EntityService = ( property , column ) =>
6063 {
@@ -73,7 +76,7 @@ public static void AddSqlsugarSetup(this IServiceCollection services)
7376 else
7477 {
7578 if ( string . Equals ( config . ConfigId . ToString ( ) , MainDb . CurrentDbConnId ,
76- StringComparison . CurrentCultureIgnoreCase ) )
79+ StringComparison . CurrentCultureIgnoreCase ) )
7780 {
7881 BaseDBConfig . MainConfig = config ;
7982 }
@@ -103,7 +106,7 @@ public static void AddSqlsugarSetup(this IServiceCollection services)
103106 {
104107 BaseDBConfig . ValidConfig . ForEach ( config =>
105108 {
106- var dbProvider = db . GetConnectionScope ( ( string ) config . ConfigId ) ;
109+ var dbProvider = db . GetConnectionScope ( ( string ) config . ConfigId ) ;
107110
108111 // 打印SQL语句
109112 dbProvider . Aop . OnLogExecuting = ( s , parameters ) =>
0 commit comments