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) {