-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathServiceCollectionExtensions.cs
More file actions
28 lines (24 loc) · 991 Bytes
/
ServiceCollectionExtensions.cs
File metadata and controls
28 lines (24 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright (c) BootstrapBlazor & Argo Zhang (argo@live.ca). All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/
using BootstrapBlazor.Components;
namespace Microsoft.Extensions.DependencyInjection;
/// <summary>
/// BootstrapBlazor 服务扩展类
/// </summary>
public static class ServiceCollectionExtensions
{
/// <summary>
/// 添加 IP2RegionService 服务
/// </summary>
/// <param name="services"></param>
public static IServiceCollection AddBootstrapBlazorIP2RegionService(this IServiceCollection services)
{
services.AddSingleton<IIpLocatorProvider, IP2RegionService>();
#if NET8_0_OR_GREATER
services.AddKeyedSingleton<IIpLocatorProvider, IP2RegionService>("BootstrapBlazor.IP2Region");
#endif
services.AddOptionsMonitor<IP2RegionOptions>();
return services;
}
}