diff --git a/VideoAnalysis/Expand/CoravelExpand.cs b/VideoAnalysis/Expand/CoravelExpand.cs index df884ec..3e43beb 100644 --- a/VideoAnalysis/Expand/CoravelExpand.cs +++ b/VideoAnalysis/Expand/CoravelExpand.cs @@ -19,6 +19,7 @@ namespace Learn.VideoAnalysis.Expand Console.WriteLine($"{DateTime.Now}=>初始化 Coravel"); service.AddScheduler(); service.AddTransient(); + service.AddTransient(); } public static void UseCoravelExpand(this IServiceProvider provider) { @@ -27,7 +28,7 @@ namespace Learn.VideoAnalysis.Expand //每5分钟执行一次 未处理视频扫描 scheduler.Schedule().EveryFiveMinutes(); //每天两点 - scheduler.Schedule().DailyAtHour(2); + scheduler.Schedule().HourlyAt(10); }); } } diff --git a/VideoAnalysis/Expand/SqlSugarExpand.cs b/VideoAnalysis/Expand/SqlSugarExpand.cs index 41a6fe5..3761d20 100644 --- a/VideoAnalysis/Expand/SqlSugarExpand.cs +++ b/VideoAnalysis/Expand/SqlSugarExpand.cs @@ -21,6 +21,7 @@ namespace Learn.VideoAnalysis.Expand public static void AddSqlSugarExpand(this IServiceCollection services) { + services.AddHttpContextAccessor(); Console.WriteLine($"{DateTime.Now}=>初始化 YitId雪花ID"); var options = new IdGeneratorOptions(ushort.Parse(AppCommon.Config.ID)); YitIdHelper.SetIdGenerator(options); @@ -42,7 +43,7 @@ namespace Learn.VideoAnalysis.Expand DbType = s.SqlType, IsAutoCloseConnection = true })); - services.AddSingleton(typeof(Repository<>)); + services.AddTransient(typeof(Repository<>)); //注入SqlSugar 主库 services.AddSqlSugar(dbList); diff --git a/VideoAnalysis/Program.cs b/VideoAnalysis/Program.cs index 27bdfd7..b8b558f 100644 --- a/VideoAnalysis/Program.cs +++ b/VideoAnalysis/Program.cs @@ -28,7 +28,6 @@ namespace Learn.VideoAnalysis .AddInteractiveServerComponents(); //.AddInteractiveWebAssemblyComponents(); - builder.Services.AddHttpContextAccessor(); builder.Services.AddLogging(loggingBuilder => { diff --git a/VideoAnalysisCore/Common/Repository.cs b/VideoAnalysisCore/Common/Repository.cs index 332ea87..37f0cc6 100644 --- a/VideoAnalysisCore/Common/Repository.cs +++ b/VideoAnalysisCore/Common/Repository.cs @@ -29,8 +29,8 @@ namespace VideoAnalysisCore.Common return; } var c = t.GetCustomAttribute(); - if (!CID.ContainsKey(typeof(T))) - CID.Add(typeof(T), c?.configId); + if (!CID.ContainsKey(t)) + CID.Add(t, c?.configId); base.Context = c != null ? DbScoped.Sugar.GetConnectionScope(c.configId) : DbScoped.Sugar;