🍒 fix(LazyServer): 修复懒加载服务异常
This commit is contained in:
parent
a91dd7f134
commit
5beb7d7027
@ -11,7 +11,7 @@ namespace Admin.NET.Core;
|
||||
/// </summary>
|
||||
public class LazyHelper
|
||||
{
|
||||
private static readonly ConcurrentDictionary<Type, Lazy<object>> Cache = new();
|
||||
private static readonly ConcurrentDictionary<Type, dynamic> Cache = new();
|
||||
|
||||
/// <summary>
|
||||
/// 获取服务
|
||||
@ -22,8 +22,7 @@ public class LazyHelper
|
||||
{
|
||||
try
|
||||
{
|
||||
var lazy = Cache.GetOrAdd(typeof(T), _ => new Lazy<object>(() => App.GetService<T>()));
|
||||
return (Lazy<T>)(object)lazy;
|
||||
return Cache.GetOrAdd(typeof(T), _ => new Lazy<T>(() => App.GetService<T>()));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user