From 24dcb24e2431c632d37ce67b2c6df1eb1d2d64a7 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 19 Oct 2025 15:08:16 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=20Keyed=20?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/ServiceCollectionExtensions.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/binding/csharp/IP2Region.Net/Extensions/ServiceCollectionExtensions.cs b/binding/csharp/IP2Region.Net/Extensions/ServiceCollectionExtensions.cs index eeacdb3..dfd4518 100644 --- a/binding/csharp/IP2Region.Net/Extensions/ServiceCollectionExtensions.cs +++ b/binding/csharp/IP2Region.Net/Extensions/ServiceCollectionExtensions.cs @@ -14,12 +14,15 @@ public static class BootstrapBlazoIP2RegionExtensions /// public static IServiceCollection AddIP2RegionService(this IServiceCollection services, string path, CachePolicy cachePolicy = CachePolicy.Content) { - services.AddSingleton( provider => + services.AddSingleton(provider => { return new Searcher(cachePolicy, path); }); #if NET8_0_OR_GREATER - services.AddKeyedSingleton("IP2Region.Net"); + services.AddKeyedSingleton("IP2Region.Net", (provider, _) => + { + return new Searcher(cachePolicy, path); + }); #endif return services;