-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDotPythonModuleHostingOptions.cs
More file actions
30 lines (26 loc) · 1.13 KB
/
Copy pathDotPythonModuleHostingOptions.cs
File metadata and controls
30 lines (26 loc) · 1.13 KB
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
namespace DotPython.Hosting;
/// <summary>Controls activation behavior for one typed DotPython module registration.</summary>
public sealed class DotPythonModuleHostingOptions
{
internal const int MaximumSupportedInitializationAttempts = 10;
/// <summary>
/// Gets or sets whether a Generic Host should load and validate the module during startup.
/// </summary>
public bool WarmUpOnHostStart { get; set; }
/// <summary>
/// Gets or sets the maximum number of module initialization attempts, including the first
/// attempt. The default is one and the maximum supported value is ten.
/// </summary>
public int MaximumInitializationAttempts { get; set; } = 1;
internal void Validate()
{
if (MaximumInitializationAttempts is < 1 or > MaximumSupportedInitializationAttempts)
{
throw new ArgumentOutOfRangeException(
nameof(MaximumInitializationAttempts),
MaximumInitializationAttempts,
$"The maximum initialization attempt count must be between 1 and {MaximumSupportedInitializationAttempts}."
);
}
}
}