ViewEngineOptions.cs
1.8 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
using NCC.Dependency;
using NCC.Reflection;
using Microsoft.CodeAnalysis;
using System.Collections.Generic;
using System.Reflection;
namespace NCC.ViewEngine
{
/// <summary>
/// 视图引擎编译选项
/// </summary>
[SuppressSniffer]
public class ViewEngineOptions
{
/// <summary>
/// 构造函数
/// </summary>
public ViewEngineOptions()
{
ReferencedAssemblies = new HashSet<Assembly>()
{
typeof(object).Assembly,
typeof(ViewEngineModel).Assembly,
typeof(System.Collections.IList).Assembly,
typeof(IEnumerable<>).Assembly,
Reflect.GetAssembly("Microsoft.CSharp"),
Reflect.GetAssembly("System.Runtime"),
Reflect.GetAssembly("System.Linq"),
Reflect.GetAssembly("System.Linq.Expressions")
};
}
/// <summary>
/// 引用程序集
/// </summary>
public HashSet<Assembly> ReferencedAssemblies { get; set; }
/// <summary>
/// 元数据引用
/// </summary>
public HashSet<MetadataReference> MetadataReferences { get; set; } = new HashSet<MetadataReference>();
/// <summary>
/// 模板命名空间
/// </summary>
public string TemplateNamespace { get; set; } = "NCC.ViewEngine";
/// <summary>
/// 继承
/// </summary>
public string Inherits { get; set; } = "NCC.ViewEngine.Template.Models";
/// <summary>
/// 默认 Using
/// </summary>
public HashSet<string> DefaultUsings { get; set; } = new HashSet<string>()
{
"System.Linq",
"System.Collections",
"System.Collections.Generic"
};
}
}