-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigurationAttribute.cs
More file actions
29 lines (26 loc) · 896 Bytes
/
ConfigurationAttribute.cs
File metadata and controls
29 lines (26 loc) · 896 Bytes
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
namespace DigitalRuby.SimpleDi;
/// <summary>
/// Register a class for DI from configuration
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class ConfigurationAttribute : Attribute
{
/// <summary>
/// Config path
/// </summary>
public string ConfigPath { get; internal set; }
/// <summary>
/// Dynamic, can be loaded at runtime and hot reloaded
/// </summary>
public bool IsDynamic { get; }
/// <summary>
/// Constructor
/// </summary>
/// <param name="configPath">Config path to bind from configuration. This can be left empty to use the FullName from the type this attribute annotates.</param>
/// <param name="isDynamic">True (dynamic) can reload values at runtime, false (static) loads values once at startup.</param>
public ConfigurationAttribute(string configPath = "", bool isDynamic = false)
{
ConfigPath = configPath;
IsDynamic = isDynamic;
}
}