zuohuaijun 3 лет назад
Родитель
Сommit
b2b408255c

+ 7 - 0
Admin.NET/Admin.NET.Core/Admin.NET.Core.xml

@@ -3788,6 +3788,13 @@
             <param name="dataScopeType"></param>
             <returns></returns>
         </member>
+        <member name="M:Admin.NET.Core.Service.SysCacheService.CacheDetail(System.String)">
+            <summary>
+            获取缓存
+            </summary>
+            <param name="cacheKey"></param>
+            <returns></returns>
+        </member>
         <member name="P:Admin.NET.Core.Service.CustomViewEngine.ConfigId">
             <summary>
             库定位器

+ 1 - 1
Admin.NET/Admin.NET.Core/EventBus/LogEventSubscriber.cs

@@ -3,7 +3,7 @@
 /// <summary>
 /// 日志事件订阅
 /// </summary>
-public class LogEventSubscriber : IEventSubscriber
+public class LogEventSubscriber : IEventSubscriber, ISingleton
 {
     private readonly IServiceProvider _serviceProvider;
 

+ 3 - 9
Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs

@@ -151,7 +151,7 @@ public static class SqlSugarSetup
         // 创建数据库
         dbOptions.ConnectionConfigs.ForEach(config =>
         {
-            if (config.DbType == SqlSugar.DbType.Oracle || !config.EnableInitDb) return;
+            if (!config.EnableInitDb || config.DbType == SqlSugar.DbType.Oracle) return;
             db.GetConnectionScope(config.ConfigId).DbMaintenance.CreateDatabase();
         });
 
@@ -161,21 +161,16 @@ public static class SqlSugarSetup
         if (!entityTypes.Any()) return;
         foreach (var entityType in entityTypes)
         {
-            var tAtt = entityType.GetCustomAttribute<TenantAttribute>();
+            var tAtt = entityType.GetCustomAttribute<TenantAttribute>(); // 多数据库
             var configId = tAtt == null ? SqlSugarConst.ConfigId : tAtt.configId.ToString();
             if (!dbOptions.ConnectionConfigs.FirstOrDefault(u => u.ConfigId == configId).EnableInitDb)
                 continue;
             var db2 = db.GetConnectionScope(configId);
-            //添加分表特性后,初始化数据库时自动分表
-            var splitTable = entityType.GetCustomAttribute<SplitTableAttribute>();
+            var splitTable = entityType.GetCustomAttribute<SplitTableAttribute>(); // 分表
             if (splitTable == null)
-            {
                 db2.CodeFirst.InitTables(entityType);
-            }
             else
-            {
                 db2.CodeFirst.SplitTables().InitTables(entityType);
-            }
         }
 
         // 获取所有种子配置-初始化数据
@@ -196,7 +191,6 @@ public static class SqlSugarSetup
             if (!dbOptions.ConnectionConfigs.FirstOrDefault(u => u.ConfigId == configId).EnableInitDb)
                 continue;
             var db2 = db.GetConnectionScope(configId);
-
             var seedDataTable = seedData.ToList().ToDataTable();
             seedDataTable.TableName = db.EntityMaintenance.GetEntityInfo(entityType).DbTableName;
             if (seedDataTable.Columns.Contains(SqlSugarConst.PrimaryKey))

+ 0 - 2
Admin.NET/Admin.NET.Web.Core/Startup.cs

@@ -87,8 +87,6 @@ public class Startup : AppStartup
         {
             // 不启用事件日志
             options.LogEnabled = false;
-            // 订阅日志事件
-            options.AddSubscriber<LogEventSubscriber>();
             // 事件执行器(失败重试)
             options.AddExecutor<RetryEventHandlerExecutor>();
         });