-
Notifications
You must be signed in to change notification settings - Fork 2k
/
SiloOptionsOverrides.cs
36 lines (32 loc) · 2.51 KB
/
SiloOptionsOverrides.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
34
35
36
using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Orleans.Hosting;
using Orleans.Runtime;
namespace Orleans.Configuration.Overrides
{
public static class SiloOptionsOverrides
{
/// <summary>
/// Add an override <see cref="ClusterOptions"/> on a per-provider basis.
/// Note: This is intended for migration purposes as a means to handle previously inconsistent behaviors in how providers used ServiceId and ClusterId.
/// </summary>
public static ISiloHostBuilder AddProviderClusterOptions(this ISiloHostBuilder builder, string providerName, Action<OptionsBuilder<ClusterOptions>> configureOptions) => builder.ConfigureServices(services => services.AddOptionsOverride<ClusterOptions>(providerName, configureOptions));
/// <summary>
/// Add an override <see cref="ClusterOptions"/> on a per-provider basis.
/// Note: This is intended for migration purposes as a means to handle previously inconsistent behaviors in how providers used ServiceId and ClusterId.
/// </summary>
public static ISiloHostBuilder AddProviderClusterOptions(this ISiloHostBuilder builder, string providerName, Action<ClusterOptions> configureOptions) => builder.ConfigureServices(services => services.AddOptionsOverride<ClusterOptions>(providerName, ob => ob.Configure(configureOptions)));
/// <summary>
/// Add an override <see cref="ClusterOptions"/> on a per-provider basis.
/// Note: This is intended for migration purposes as a means to handle previously inconsistent behaviors in how providers used ServiceId and ClusterId.
/// </summary>
public static ISiloBuilder AddProviderClusterOptions(this ISiloBuilder builder, string providerName, Action<OptionsBuilder<ClusterOptions>> configureOptions) => builder.ConfigureServices(services => services.AddOptionsOverride<ClusterOptions>(providerName, configureOptions));
/// <summary>
/// Add an override <see cref="ClusterOptions"/> on a per-provider basis.
/// Note: This is intended for migration purposes as a means to handle previously inconsistent behaviors in how providers used ServiceId and ClusterId.
/// </summary>
public static ISiloBuilder AddProviderClusterOptions(this ISiloBuilder builder, string providerName, Action<ClusterOptions> configureOptions) => builder.ConfigureServices(services => services.AddOptionsOverride<ClusterOptions>(providerName, ob => ob.Configure(configureOptions)));
}
}