-
Notifications
You must be signed in to change notification settings - Fork 287
/
TelemetryConfigurationOptions.cs
33 lines (30 loc) · 1.38 KB
/
TelemetryConfigurationOptions.cs
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
29
30
31
32
33
namespace Microsoft.Extensions.DependencyInjection
{
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.Extensions.Options;
/// <summary>
/// The <see cref="IOptions{TelemetryConfiguration}"/> implementation that create new <see cref="TelemetryConfiguration"/> every time when called".
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "This class is instantiated by Dependency Injection.")]
internal class TelemetryConfigurationOptions : IOptions<TelemetryConfiguration>
{
/// <summary>
/// Initializes a new instance of the <see cref="TelemetryConfigurationOptions"/> class.
/// </summary>
/// <param name="configureOptions">Collection of options to be configured.</param>
public TelemetryConfigurationOptions(IEnumerable<IConfigureOptions<TelemetryConfiguration>> configureOptions)
{
this.Value = TelemetryConfiguration.CreateDefault();
var configureOptionsArray = configureOptions.ToArray();
foreach (var c in configureOptionsArray)
{
c.Configure(this.Value);
}
}
/// <inheritdoc />
public TelemetryConfiguration Value { get; }
}
}