-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
OptionsWrapper.cs
30 lines (27 loc) · 990 Bytes
/
OptionsWrapper.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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics.CodeAnalysis;
namespace Microsoft.Extensions.Options
{
/// <summary>
/// <see cref="IOptions{TOptions}"/> wrapper that returns the options instance.
/// </summary>
/// <typeparam name="TOptions">Options type.</typeparam>
public class OptionsWrapper<[DynamicallyAccessedMembers(Options.DynamicallyAccessedMembers)] TOptions> :
IOptions<TOptions>
where TOptions : class
{
/// <summary>
/// Initializes the wrapper with the options instance to return.
/// </summary>
/// <param name="options">The options instance to return.</param>
public OptionsWrapper(TOptions options)
{
Value = options;
}
/// <summary>
/// The options instance.
/// </summary>
public TOptions Value { get; }
}
}