forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefaultCompilerServiceFactory.cs
More file actions
32 lines (30 loc) · 1.26 KB
/
Copy pathDefaultCompilerServiceFactory.cs
File metadata and controls
32 lines (30 loc) · 1.26 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
using System;
using System.Web.Razor.Parser;
using ServiceStack.RazorEngine.Compilation.CSharp;
namespace ServiceStack.RazorEngine.Compilation
{
/// <summary>
/// Provides a default implementation of a compiler service factory.
/// </summary>
public class DefaultCompilerServiceFactory : ICompilerServiceFactory
{
#region Methods
/// <summary>
/// Creates an instance of a compiler service.
/// </summary>
/// <param name="language">The language to support in templates.</param>
/// <param name="strictMode">Strict mode forces parsing exceptions to be thrown.</param>
/// <param name="markupParser">The markup parser to use.</param>
/// <returns>An instance of <see cref="ICompilerService"/>.</returns>
public ICompilerService CreateCompilerService(Language language = Language.CSharp, bool strictMode = false, MarkupParser markupParser = null)
{
switch (language)
{
case Language.CSharp:
return new CSharpDirectCompilerService(strictMode, markupParser);
}
throw new ArgumentException("The language '" + language + "' is not supported.");
}
#endregion
}
}