Skip to content

Commit

Permalink
[fix]降低RedisCacheProvider对IConfigProvider的依赖,在外部没有注册IConfigProvider时(…
Browse files Browse the repository at this point in the history
…常见于没有星尘),自动加载本地配置文件。
  • Loading branch information
nnhy committed Oct 31, 2024
1 parent 1456b66 commit 8170a4a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion NewLife.Redis/Services/RedisCacheProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public RedisCacheProvider() { }
/// <param name="serviceProvider"></param>
public RedisCacheProvider(IServiceProvider serviceProvider)
{
var config = serviceProvider.GetRequiredService<IConfigProvider>();
var config = serviceProvider?.GetService<IConfigProvider>();
config ??= JsonConfigProvider.LoadAppSettings();
if (config != null) Init(config, serviceProvider);
}
#endregion
Expand Down

0 comments on commit 8170a4a

Please sign in to comment.