-
Notifications
You must be signed in to change notification settings - Fork 730
/
IContextualOptions.cs
25 lines (22 loc) · 1.09 KB
/
IContextualOptions.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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.Extensions.Options.Contextual;
/// <summary>
/// Used to retrieve configured <typeparamref name="TOptions"/> instances.
/// </summary>
/// <typeparam name="TOptions">The type of options being requested.</typeparam>
/// <typeparam name="TContext">A type defining the context for this request.</typeparam>
public interface IContextualOptions<TOptions, TContext>
where TOptions : class
where TContext : IOptionsContext
{
/// <summary>
/// Gets the configured <typeparamref name="TOptions"/> instance.
/// </summary>
/// <param name="context">The context that will be used to create the options.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>A configured instance of <typeparamref name="TOptions"/>.</returns>
ValueTask<TOptions> GetAsync(in TContext context, CancellationToken cancellationToken);
}