-
Notifications
You must be signed in to change notification settings - Fork 2k
/
AdoNetClusteringClientOptionsValidator.cs
33 lines (29 loc) · 1.23 KB
/
AdoNetClusteringClientOptionsValidator.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
using Microsoft.Extensions.Options;
using Orleans.Runtime;
using Orleans.Runtime.MembershipService;
namespace Orleans.Configuration
{
/// <summary>
/// Validates <see cref="AdoNetClusteringClientOptions"/> configuration.
/// </summary>
public class AdoNetClusteringClientOptionsValidator : IConfigurationValidator
{
private readonly AdoNetClusteringClientOptions options;
public AdoNetClusteringClientOptionsValidator(IOptions<AdoNetClusteringClientOptions> options)
{
this.options = options.Value;
}
/// <inheritdoc />
public void ValidateConfiguration()
{
if (string.IsNullOrWhiteSpace(this.options.Invariant))
{
throw new OrleansConfigurationException($"Invalid {nameof(AdoNetClusteringClientOptions)} values for {nameof(AdoNetClusteringTable)}. {nameof(options.Invariant)} is required.");
}
if (string.IsNullOrWhiteSpace(this.options.ConnectionString))
{
throw new OrleansConfigurationException($"Invalid {nameof(AdoNetClusteringClientOptions)} values for {nameof(AdoNetClusteringTable)}. {nameof(options.ConnectionString)} is required.");
}
}
}
}