forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebConfigTransformer.cs
More file actions
26 lines (21 loc) · 1.01 KB
/
WebConfigTransformer.cs
File metadata and controls
26 lines (21 loc) · 1.01 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
using System.Collections.Generic;
namespace ServiceStack.Razor.Compilation.CodeTransformers
{
public class WebConfigTransformer : AggregateCodeTransformer
{
private readonly string DefaultBaseType = typeof(ViewPage).FullName;
private const string RazorWebPagesSectionName = "system.web.webPages.razor/pages";
private readonly List<RazorCodeTransformerBase> _transformers = new List<RazorCodeTransformerBase>();
public static HashSet<string> RazorNamespaces { get; set; }
protected override IEnumerable<RazorCodeTransformerBase> CodeTransformers => _transformers;
public override void Initialize(RazorPageHost razorHost, IDictionary<string, string> directives)
{
//read the base type here from the web.config here
foreach (var ns in (RazorNamespaces ?? HostContext.Config.RazorNamespaces))
{
razorHost.NamespaceImports.Add(ns);
}
base.Initialize(razorHost, directives);
}
}
}