2 implementations of IConfigureContextualOptions
Microsoft.Extensions.Options.Contextual (2)
Internal\ConfigureContextualOptions.cs (1)
14
internal sealed class ConfigureContextualOptions<TOptions> :
IConfigureContextualOptions
<TOptions>
Provider\NullConfigureContextualOptions_1.cs (1)
12
internal sealed class NullConfigureContextualOptions<TOptions> :
IConfigureContextualOptions
<TOptions>
32 references to IConfigureContextualOptions
Microsoft.Extensions.Options.Contextual (16)
ContextualOptionsServiceCollectionExtensions.cs (4)
45
Func<IOptionsContext, CancellationToken, ValueTask<
IConfigureContextualOptions
<TOptions>>> loadOptions)
60
Func<IOptionsContext, CancellationToken, ValueTask<
IConfigureContextualOptions
<TOptions>>> loadOptions)
99
new ValueTask<
IConfigureContextualOptions
<TOptions>>(
112
Func<IOptionsContext, CancellationToken, ValueTask<
IConfigureContextualOptions
<TOptions>>> loadOptions)
Internal\ContextualOptionsFactory.cs (3)
78
var loadTasks = ArrayPool<ValueTask<
IConfigureContextualOptions
<TOptions>>>.Shared.Rent(_loaders.Length);
101
using
var
configurer = await loadTasks[i].ConfigureAwait(false); // ValueTasks are awaited only here and only once.
118
ArrayPool<ValueTask<
IConfigureContextualOptions
<TOptions>>>.Shared.Return(loadTasks);
Internal\LoadContextualOptions.cs (4)
24
public LoadContextualOptions(string? name, Func<IOptionsContext, CancellationToken, ValueTask<
IConfigureContextualOptions
<TOptions>>> load)
38
public Func<IOptionsContext, CancellationToken, ValueTask<
IConfigureContextualOptions
<TOptions>>> LoadAction { get; }
41
public ValueTask<
IConfigureContextualOptions
<TOptions>> LoadAsync<TContext>(string name, in TContext context, CancellationToken cancellationToken)
52
return new ValueTask<
IConfigureContextualOptions
<TOptions>>(NullConfigureContextualOptions.GetInstance<TOptions>());
Provider\ILoadContextualOptions.cs (1)
24
ValueTask<
IConfigureContextualOptions
<TOptions>> LoadAsync<TContext>(string name, in TContext context, CancellationToken cancellationToken)
Provider\NullConfigureContextualOptions.cs (2)
15
/// <returns>A do-nothing instance of <see cref="
IConfigureContextualOptions
{TOptions}"/>.</returns>
16
public static
IConfigureContextualOptions
<TOptions> GetInstance<TOptions>()
Provider\NullConfigureContextualOptions_1.cs (2)
9
/// Implements <see cref="
IConfigureContextualOptions
{TOptions}"/> but does nothing.
15
internal static
IConfigureContextualOptions
<TOptions> Instance { get; } = new NullConfigureContextualOptions<TOptions>();
Microsoft.Extensions.Options.Contextual.Tests (16)
ContextualOptionsFactoryTests.cs (12)
67
(context, _) => new ValueTask<
IConfigureContextualOptions
<List<string>>>(new ConfigureContextualOptions<List<string>>((_, list) => list.Add("configure"), context))),
88
(context, _) => new ValueTask<
IConfigureContextualOptions
<List<string>>>(new ConfigureContextualOptions<List<string>>((_, list) => list.Add("configure"), context)))
108
(context, _) => new ValueTask<
IConfigureContextualOptions
<List<string>>>(new ConfigureContextualOptions<List<string>>((_, list) => list.Add("configure"), context))),
175
return new ValueTask<
IConfigureContextualOptions
<List<string>>>(new ConfigureContextualOptions<List<string>>((_, list) => list.Add("1"), context));
185
return new ValueTask<
IConfigureContextualOptions
<List<string>>>(new ConfigureContextualOptions<List<string>>((_, list) => list.Add("3"), context));
190
return new ValueTask<
IConfigureContextualOptions
<List<string>>>(new ConfigureContextualOptions<List<string>>((_, list) => list.Add("4"), context));
212
new(string.Empty, (context, _) => new ValueTask<
IConfigureContextualOptions
<List<string>>>(Mock.Of<
IConfigureContextualOptions
<List<string>>>(MockBehavior.Strict))),
233
var disposeMock = new Mock<
IConfigureContextualOptions
<List<string>>>();
237
new(string.Empty, (context, _) => new ValueTask<
IConfigureContextualOptions
<List<string>>>(Mock.Of<
IConfigureContextualOptions
<List<string>>>(MockBehavior.Strict))),
238
new(string.Empty, (context, _) => new ValueTask<
IConfigureContextualOptions
<List<string>>>(disposeMock.Object)),
ContextualOptionsServiceCollectionExtensionsTests.cs (4)
32
Func<IOptionsContext, CancellationToken, ValueTask<
IConfigureContextualOptions
<string>>> loadOptions =
33
(_, _) => new ValueTask<
IConfigureContextualOptions
<string>>(NullConfigureContextualOptions.GetInstance<string>());
54
Func<IOptionsContext, CancellationToken, ValueTask<
IConfigureContextualOptions
<string>>> loadOptions =
55
(_, _) => new ValueTask<
IConfigureContextualOptions
<string>>(NullConfigureContextualOptions.GetInstance<string>());