forked from aspnet/AspNetWebStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCSharpRazorCodeGenerator.cs
More file actions
31 lines (25 loc) · 1.21 KB
/
CSharpRazorCodeGenerator.cs
File metadata and controls
31 lines (25 loc) · 1.21 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
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.CodeDom;
using System.Diagnostics.CodeAnalysis;
namespace System.Web.Razor.Generator
{
public class CSharpRazorCodeGenerator : RazorCodeGenerator
{
private const string HiddenLinePragma = "#line hidden";
public CSharpRazorCodeGenerator(string className, string rootNamespaceName, string sourceFileName, RazorEngineHost host)
: base(className, rootNamespaceName, sourceFileName, host)
{
}
internal override Func<CodeWriter> CodeWriterFactory
{
get { return () => new CSharpCodeWriter(); }
}
[SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "System.CodeDom.CodeSnippetTypeMember.#ctor(System.String)", Justification = "Value is never to be localized")]
protected override void Initialize(CodeGeneratorContext context)
{
base.Initialize(context);
context.GeneratedClass.Members.Insert(0, new CodeSnippetTypeMember(HiddenLinePragma));
}
}
}