using IP2Region.Net.Abstractions; using IP2Region.Net.XDB; namespace Microsoft.Extensions.DependencyInjection; /// /// BootstrapBlazor 服务扩展类 /// public static class BootstrapBlazoIP2RegionExtensions { /// /// 添加 IP2RegionService 服务 /// /// public static IServiceCollection AddIP2RegionService(this IServiceCollection services, string path, CachePolicy cachePolicy = CachePolicy.Content) { services.AddSingleton(provider => { return new Searcher(cachePolicy, path); }); #if NET8_0_OR_GREATER services.AddKeyedSingleton("IP2Region.Net", (provider, _) => { return new Searcher(cachePolicy, path); }); #endif return services; } }