|
3 | 3 |
|
4 | 4 | #nullable enable
|
5 | 5 |
|
6 |
| -using System.Diagnostics; |
7 | 6 | #if !NETFRAMEWORK && !NETSTANDARD2_0
|
8 | 7 | using System.Diagnostics.CodeAnalysis;
|
9 | 8 | #endif
|
10 | 9 | using System.Globalization;
|
11 |
| -using Microsoft.Extensions.Configuration; |
12 |
| -using Microsoft.Extensions.DependencyInjection; |
13 |
| -using Microsoft.Extensions.DependencyInjection.Extensions; |
14 |
| -using Microsoft.Extensions.Options; |
15 | 10 |
|
16 |
| -namespace OpenTelemetry.Internal; |
| 11 | +namespace Microsoft.Extensions.Configuration; |
17 | 12 |
|
18 |
| -internal static class ConfigurationExtensions |
| 13 | +internal static class OpenTelemetryConfigurationExtensions |
19 | 14 | {
|
20 | 15 | public static Action<string, string>? LogInvalidEnvironmentVariable = null;
|
21 | 16 |
|
@@ -125,46 +120,4 @@ public static bool TryGetValue<T>(
|
125 | 120 |
|
126 | 121 | return true;
|
127 | 122 | }
|
128 |
| - |
129 |
| - public static IServiceCollection RegisterOptionsFactory<T>( |
130 |
| - this IServiceCollection services, |
131 |
| - Func<IConfiguration, T> optionsFactoryFunc) |
132 |
| - where T : class |
133 |
| - { |
134 |
| - Debug.Assert(services != null, "services was null"); |
135 |
| - Debug.Assert(optionsFactoryFunc != null, "optionsFactoryFunc was null"); |
136 |
| - |
137 |
| - services!.TryAddSingleton<IOptionsFactory<T>>(sp => |
138 |
| - { |
139 |
| - return new DelegatingOptionsFactory<T>( |
140 |
| - (c, n) => optionsFactoryFunc!(c), |
141 |
| - sp.GetRequiredService<IConfiguration>(), |
142 |
| - sp.GetServices<IConfigureOptions<T>>(), |
143 |
| - sp.GetServices<IPostConfigureOptions<T>>(), |
144 |
| - sp.GetServices<IValidateOptions<T>>()); |
145 |
| - }); |
146 |
| - |
147 |
| - return services!; |
148 |
| - } |
149 |
| - |
150 |
| - public static IServiceCollection RegisterOptionsFactory<T>( |
151 |
| - this IServiceCollection services, |
152 |
| - Func<IServiceProvider, IConfiguration, string, T> optionsFactoryFunc) |
153 |
| - where T : class |
154 |
| - { |
155 |
| - Debug.Assert(services != null, "services was null"); |
156 |
| - Debug.Assert(optionsFactoryFunc != null, "optionsFactoryFunc was null"); |
157 |
| - |
158 |
| - services!.TryAddSingleton<IOptionsFactory<T>>(sp => |
159 |
| - { |
160 |
| - return new DelegatingOptionsFactory<T>( |
161 |
| - (c, n) => optionsFactoryFunc!(sp, c, n), |
162 |
| - sp.GetRequiredService<IConfiguration>(), |
163 |
| - sp.GetServices<IConfigureOptions<T>>(), |
164 |
| - sp.GetServices<IPostConfigureOptions<T>>(), |
165 |
| - sp.GetServices<IValidateOptions<T>>()); |
166 |
| - }); |
167 |
| - |
168 |
| - return services!; |
169 |
| - } |
170 | 123 | }
|
0 commit comments