forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptConfig.cs
More file actions
104 lines (97 loc) · 3.84 KB
/
ScriptConfig.cs
File metadata and controls
104 lines (97 loc) · 3.84 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
using System;
using System.Collections.Generic;
using System.Globalization;
namespace ServiceStack.Script
{
public static class ScriptConfig
{
public static HashSet<string> RemoveNewLineAfterFiltersNamed { get; set; } = new HashSet<string>
{
"assignTo",
"assignToGlobal",
"assignError",
"addTo",
"addToGlobal",
"addToStart",
"addToStartGlobal",
"appendTo",
"appendToGlobal",
"prependTo",
"prependToGlobal",
"do",
"end",
"throw",
"ifthrow",
"throwIf",
"throwIf",
"ifThrowArgumentException",
"ifThrowArgumentNullException",
"throwArgumentNullExceptionIf",
"throwArgumentException",
"throwArgumentNullException",
"throwNotSupportedException",
"throwNotImplementedException",
"throwUnauthorizedAccessException",
"throwFileNotFoundException",
"throwOptimisticConcurrencyException",
"throwNotSupportedException",
"ifError",
"ifErrorFmt",
"skipExecutingFiltersOnError",
"continueExecutingFiltersOnError",
"publishToGateway",
};
public static HashSet<string> OnlyEvaluateFiltersWhenSkippingPageFilterExecution { get; set; } = new HashSet<string>
{
"ifError",
"lastError",
"htmlError",
"htmlErrorMessage",
"htmlErrorDebug",
};
/// <summary>
/// Rethrow fatal exceptions thrown on incorrect API usage
/// </summary>
public static HashSet<Type> FatalExceptions { get; set; } = new HashSet<Type>
{
typeof(NotSupportedException),
typeof(System.Reflection.TargetInvocationException),
typeof(NotImplementedException),
};
public static HashSet<Type> CaptureAndEvaluateExceptionsToNull { get; set; } = new HashSet<Type>
{
typeof(NullReferenceException),
typeof(ArgumentNullException),
};
public static HashSet<string> DontEvaluateBlocksNamed { get; set; } = new HashSet<string> {
"raw"
};
public static int MaxQuota { get; set; } = 10000;
public static CultureInfo DefaultCulture { get; set; } //Uses CurrentCulture by default
public static string DefaultDateFormat { get; set; } = "yyyy-MM-dd";
public static string DefaultDateTimeFormat { get; set; } = "u";
public static string DefaultTimeFormat { get; set; } = @"h\:mm\:ss";
public static TimeSpan DefaultFileCacheExpiry { get; set; } =TimeSpan.FromMinutes(1);
public static TimeSpan DefaultUrlCacheExpiry { get; set; } =TimeSpan.FromMinutes(1);
public static string DefaultIndent { get; set; } = "\t";
public static string DefaultNewLine { get; set; } = Environment.NewLine;
public static string DefaultJsConfig { get; set; } = "excludetypeinfo";
public static StringComparison DefaultStringComparison { get; set; } = StringComparison.Ordinal;
public static string DefaultTableClassName { get; set; } = "table";
public static string DefaultErrorClassName { get; set; } = "alert alert-danger";
public static CultureInfo CreateCulture()
{
var culture = DefaultCulture;
if (culture == null)
{
culture = CultureInfo.CurrentCulture;
}
if (Equals(culture, CultureInfo.InvariantCulture))
{
culture = (CultureInfo) culture.Clone();
culture.NumberFormat.CurrencySymbol = "$";
}
return culture;
}
}
}