Selaa lähdekoodia

更新依赖包,升级Freesql至3.2.693
新增 DbConfig.IdleTime空闲时间设置, FreeSqlCloud注册数据库支持空闲时间配置

zhontai 2 vuotta sitten
vanhempi
commit
d650fa1e1c

+ 1 - 1
build/pkg.props

@@ -1,6 +1,6 @@
 <Project>
   <PropertyGroup>
-    <Version>3.5.0</Version>
+    <Version>3.6.0</Version>
 	<TargetFramework>net7.0</TargetFramework>
 	<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
 	<GenerateDocumentationFile>true</GenerateDocumentationFile>

+ 1 - 1
src/hosts/ZhonTai.Host/Configs/appconfig.json

@@ -38,7 +38,7 @@
       {
         "name": "中台Admin",
         "code": "admin",
-        "version": "v3.5.0",
+        "version": "v3.6.0",
         "description": ""
       }
     ]

+ 3 - 0
src/hosts/ZhonTai.Host/Configs/dbconfig.json

@@ -66,6 +66,9 @@
     //}
   ],
 
+  //空闲时间(分),若<=0或null则不自动回收
+  "idleTime": 0,
+
   //多数据库
   //定义DbKeys枚举
   //使用仓储访问 public ModuleRepository(UnitOfWorkManagerCloud muowm) : base(DbKeys.AppDb, muowm)

+ 6 - 6
src/hosts/ZhonTai.Host/ZhonTai.Host.csproj

@@ -16,12 +16,12 @@
 	</ItemGroup>
 
 	<ItemGroup Condition="'$(Configuration)'=='Debug'">
-		<PackageReference Include="FreeSql.Provider.MySql" Version="3.2.692" />
-		<PackageReference Include="FreeSql.Provider.SqlServer" Version="3.2.692" />
-		<PackageReference Include="FreeSql.Provider.PostgreSQL" Version="3.2.692" />
-		<PackageReference Include="FreeSql.Provider.Oracle" Version="3.2.692" />
-		<PackageReference Include="FreeSql.Provider.Sqlite" Version="3.2.692" />
-		<PackageReference Include="FreeSql.Provider.MySqlConnector" Version="3.2.692" />
+		<PackageReference Include="FreeSql.Provider.MySql" Version="3.2.693" />
+		<PackageReference Include="FreeSql.Provider.SqlServer" Version="3.2.693" />
+		<PackageReference Include="FreeSql.Provider.PostgreSQL" Version="3.2.693" />
+		<PackageReference Include="FreeSql.Provider.Oracle" Version="3.2.693" />
+		<PackageReference Include="FreeSql.Provider.Sqlite" Version="3.2.693" />
+		<PackageReference Include="FreeSql.Provider.MySqlConnector" Version="3.2.693" />
 	</ItemGroup>
 	
 	<ItemGroup>

+ 5 - 0
src/platform/ZhonTai.Admin/Core/Configs/DbConfig.cs

@@ -93,6 +93,11 @@ public class DbConfig
     /// </summary>
     public bool Curd { get; set; } = false;
 
+    /// <summary>
+    /// 空闲时间(分)
+    /// </summary>
+    public int? IdleTime { get; set; } = 10;
+
     /// <summary>
     /// 多数据库
     /// </summary>

+ 2 - 1
src/platform/ZhonTai.Admin/Core/Db/DbHelper.cs

@@ -456,6 +456,7 @@ public class DbHelper
     )
     {
         //注册数据库
+        var idelTiem = dbConfig.IdleTime.HasValue && dbConfig.IdleTime.Value > 0 ? TimeSpan.FromMinutes(dbConfig.IdleTime.Value) : TimeSpan.MaxValue;
         freeSqlCloud.Register(dbConfig.Key, () =>
         {
             //创建数据库
@@ -605,7 +606,7 @@ public class DbHelper
             #endregion 监听Curd操作
 
             return fsql;
-        });
+        }, idelTiem);
 
         //执行注册数据库
         var fsql = freeSqlCloud.Use(dbConfig.Key);

+ 7 - 7
src/platform/ZhonTai.Admin/ZhonTai.Admin.csproj

@@ -15,12 +15,12 @@
 		<PackageReference Include="Autofac.Extras.DynamicProxy" Version="6.0.1" />
 		<PackageReference Include="Castle.Core.AsyncInterceptor" Version="2.1.0" />
 		<PackageReference Include="DotNetCore.CAP" Version="7.1.0" />
-		<PackageReference Include="FluentValidation.AspNetCore" Version="11.2.2" />
+		<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.0" />
 		<PackageReference Include="FreeRedis" Version="1.0.8" />
 		<PackageReference Include="FreeRedis.DistributedCache" Version="1.0.5" />
-		<PackageReference Include="FreeSql" Version="3.2.692" />
-		<PackageReference Include="FreeSql.Cloud" Version="1.6.4" />
-		<PackageReference Include="FreeSql.Repository" Version="3.2.692" />
+		<PackageReference Include="FreeSql" Version="3.2.693" />
+		<PackageReference Include="FreeSql.Cloud" Version="1.6.5" />
+		<PackageReference Include="FreeSql.Repository" Version="3.2.693" />
 		<PackageReference Include="FreeScheduler" Version="1.1.0" />
 		<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
 		<PackageReference Include="Lazy.SlideCaptcha.Core" Version="2.0.0" />
@@ -28,10 +28,10 @@
 		<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="7.0.0" />
 		<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.4" />
 		<PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.2.22" />
-		<PackageReference Include="NLog" Version="5.1.2" />
-		<PackageReference Include="NLog.Web.AspNetCore" Version="5.2.2" />
+		<PackageReference Include="NLog" Version="5.1.3" />
+		<PackageReference Include="NLog.Web.AspNetCore" Version="5.2.3" />
 		<PackageReference Include="OnceMi.AspNetCore.OSS" Version="1.1.9" />
-		<PackageReference Include="SixLabors.ImageSharp" Version="3.0.0" />
+		<PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
 		<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta15" />
 		<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.27.0" />
 		<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />

+ 5 - 0
src/platform/ZhonTai.Admin/ZhonTai.Admin.xml

@@ -690,6 +690,11 @@
             监听Curd操作
             </summary>
         </member>
+        <member name="P:ZhonTai.Admin.Core.Configs.DbConfig.IdleTime">
+            <summary>
+            空闲时间(分)
+            </summary>
+        </member>
         <member name="P:ZhonTai.Admin.Core.Configs.DbConfig.Dbs">
             <summary>
             多数据库