From 5beb7d7027d9cc7566f9c6e2202b2f77c44934dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=B5=E4=BD=A0=E4=B8=AA=E6=B1=AA=E5=91=80?= Date: Wed, 3 Sep 2025 08:23:41 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=92=20fix(LazyServer):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=87=92=E5=8A=A0=E8=BD=BD=E6=9C=8D=E5=8A=A1=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Admin.NET/Admin.NET.Core/Utils/LazyHelper.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Admin.NET/Admin.NET.Core/Utils/LazyHelper.cs b/Admin.NET/Admin.NET.Core/Utils/LazyHelper.cs index b54f564b..c317f6f5 100644 --- a/Admin.NET/Admin.NET.Core/Utils/LazyHelper.cs +++ b/Admin.NET/Admin.NET.Core/Utils/LazyHelper.cs @@ -11,7 +11,7 @@ namespace Admin.NET.Core; /// public class LazyHelper { - private static readonly ConcurrentDictionary> Cache = new(); + private static readonly ConcurrentDictionary Cache = new(); /// /// 获取服务 @@ -22,8 +22,7 @@ public class LazyHelper { try { - var lazy = Cache.GetOrAdd(typeof(T), _ => new Lazy(() => App.GetService())); - return (Lazy)(object)lazy; + return Cache.GetOrAdd(typeof(T), _ => new Lazy(() => App.GetService())); } catch (Exception) {