-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathScriptValue.cs
More file actions
46 lines (40 loc) · 1.42 KB
/
ScriptValue.cs
File metadata and controls
46 lines (40 loc) · 1.42 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
namespace ServiceStack
{
/// <summary>
/// Define a rich value that can either be a value, a constant JS Expression or a #Script Code script
/// </summary>
public interface IScriptValue
{
/// <summary>
/// Use constant Value
/// </summary>
object Value { get; set; }
/// <summary>
/// Create Value by Evaluating a #Script JS Expression. Lightweight, only evaluates an AST Token.
/// Results are only evaluated *once* and cached globally in AppHost.ScriptContext.Cache
/// </summary>
string Expression { get; set; }
/// <summary>
/// Create Value by evaluating #Script Code, results of same expression are cached per request
/// </summary>
string Eval { get; set; }
/// <summary>
/// Whether to disable result caching for this Script Value
/// </summary>
bool NoCache { get; set; }
}
public struct ScriptValue : IScriptValue
{
public object Value { get; set; }
public string Expression { get; set; }
public string Eval { get; set; }
public bool NoCache { get; set; }
}
public abstract class ScriptValueAttribute : AttributeBase, IScriptValue
{
public object Value { get; set; }
public string Expression { get; set; }
public string Eval { get; set; }
public bool NoCache { get; set; }
}
}