forked from ServiceStack/ServiceStack.Text
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJsConfigScope.cs
More file actions
76 lines (67 loc) · 2.05 KB
/
JsConfigScope.cs
File metadata and controls
76 lines (67 loc) · 2.05 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Diagnostics;
namespace ServiceStack.Text
{
public sealed class JsConfigScope : IDisposable
{
bool disposed;
JsConfigScope parent;
[ThreadStatic]
private static JsConfigScope head;
internal JsConfigScope()
{
#if !SILVERLIGHT
Thread.BeginThreadAffinity();
#endif
parent = head;
head = this;
}
internal static JsConfigScope Current
{
get
{
return head;
}
}
public static void DisposeCurrent()
{
if (head != null)
{
head.Dispose();
}
}
public void Dispose()
{
if (!disposed)
{
disposed = true;
Debug.Assert(this == head, "Disposed out of order.");
head = parent;
#if !SILVERLIGHT
Thread.EndThreadAffinity();
#endif
}
}
public bool? ConvertObjectTypesIntoStringDictionary { get; set; }
public bool? TryToParsePrimitiveTypeValues { get; set; }
public bool? IncludeNullValues { get; set; }
public bool? TreatEnumAsInteger { get; set; }
public bool? ExcludeTypeInfo { get; set; }
public bool? IncludeTypeInfo { get; set; }
public string TypeAttr { get; set; }
internal string JsonTypeAttrInObject { get; set; }
internal string JsvTypeAttrInObject { get; set; }
public Func<Type, string> TypeWriter { get; set; }
public Func<string, Type> TypeFinder { get; set; }
public JsonDateHandler? DateHandler { get; set; }
public bool? EmitCamelCaseNames { get; set; }
public bool? EmitLowercaseUnderscoreNames { get; set; }
public bool? ThrowOnDeserializationError { get; set; }
public bool? AlwaysUseUtc { get; set; }
public bool? PreferInterfaces { get; set; }
}
}