forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRazorEngineConfigurationSection.cs
More file actions
71 lines (65 loc) · 2.73 KB
/
RazorEngineConfigurationSection.cs
File metadata and controls
71 lines (65 loc) · 2.73 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System.Configuration;
namespace ServiceStack.RazorEngine.Configuration
{
/// <summary>
/// Defines the main configuration section for the RazorEngine.
/// </summary>
public class RazorEngineConfigurationSection : ConfigurationSection
{
#region Fields
private const string ActivatorAttribute = "activator";
private const string FactoryAttribute = "factory";
private const string NamespacesElement = "namespaces";
private const string SectionPath = "razorEngine";
private const string TemplateServicesElement = "templateServices";
#endregion
#region Properties
/// <summary>
/// Gets the activator used for this template service.
/// </summary>
[ConfigurationProperty(ActivatorAttribute, IsRequired = false)]
public string Activator
{
get { return (string)this[ActivatorAttribute]; }
set { this[ActivatorAttribute] = value; }
}
/// <summary>
/// Gets or sets the factory used to create compiler service instances.
/// </summary>
[ConfigurationProperty(FactoryAttribute)]
public string Factory
{
get { return (string)this[FactoryAttribute]; }
set { this[FactoryAttribute] = value; }
}
/// <summary>
/// Gets or sets the collection of namespaces.
/// </summary>
[ConfigurationProperty(NamespacesElement)]
public NamespaceConfigurationElementCollection Namespaces
{
get { return (NamespaceConfigurationElementCollection)this[NamespacesElement]; }
set { this[NamespacesElement] = value; }
}
/// <summary>
/// Gets or sets the collection of template service configurations.
/// </summary>
[ConfigurationProperty(TemplateServicesElement)]
public TemplateServiceConfigurationElementConfiguration TemplateServices
{
get { return (TemplateServiceConfigurationElementConfiguration)this[TemplateServicesElement]; }
set { this[TemplateServicesElement] = value; }
}
#endregion
#region Methods
/// <summary>
/// Gets an instance of <see cref="RazorEngineConfigurationSection"/> that represents the current configuration.
/// </summary>
/// <returns>An instance of <see cref="RazorEngineConfigurationSection"/>, or null if no configuration is specified.</returns>
public static RazorEngineConfigurationSection GetConfiguration()
{
return ConfigurationManager.GetSection(SectionPath) as RazorEngineConfigurationSection;
}
#endregion
}
}