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