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
27 lines (22 loc) · 1.02 KB
/
WebConfigTransformer.cs
File metadata and controls
27 lines (22 loc) · 1.02 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
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
{
get { return _transformers; }
}
public override void Initialize(RazorPageHost razorHost, IDictionary<string, string> directives)
{
//read the base type here from the web.config here
(RazorNamespaces ?? HostContext.Config.RazorNamespaces)
.Each(ns => razorHost.NamespaceImports.Add(ns));
base.Initialize(razorHost, directives);
}
}
}