Skip to content

Commit

Permalink
changed the forcetypeinfo to includetypeinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
allenarthurgay committed Sep 20, 2012
1 parent b98062f commit 9471011
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/ServiceStack.Text/Common/WriteType.cs
Expand Up @@ -28,9 +28,9 @@ internal static class WriteType<T, TSerializer>
internal static TypePropertyWriter[] PropertyWriters; internal static TypePropertyWriter[] PropertyWriters;
private static readonly WriteObjectDelegate WriteTypeInfo; private static readonly WriteObjectDelegate WriteTypeInfo;


private static bool IsForced private static bool IsIncluded
{ {
get { return (JsConfig.ForceTypeInfo || JsConfig<T>.ForceTypeInfo); } get { return (JsConfig.IncludeTypeInfo || JsConfig<T>.IncludeTypeInfo); }
} }
private static bool IsExcluded private static bool IsExcluded
{ {
Expand All @@ -41,7 +41,7 @@ static WriteType()
{ {
CacheFn = Init() ? GetWriteFn() : WriteEmptyType; CacheFn = Init() ? GetWriteFn() : WriteEmptyType;


if (IsForced) if (IsIncluded)
{ {
WriteTypeInfo = TypeInfoWriter; WriteTypeInfo = TypeInfoWriter;
} }
Expand All @@ -60,7 +60,7 @@ public static void TypeInfoWriter(TextWriter writer, object obj)
TryWriteTypeInfo(writer, obj); TryWriteTypeInfo(writer, obj);
} }


private static bool ShouldSkipType() { return IsExcluded && !IsForced; } private static bool ShouldSkipType() { return IsExcluded && !IsIncluded; }


private static bool TryWriteSelfType (TextWriter writer) { private static bool TryWriteSelfType (TextWriter writer) {
if (ShouldSkipType()) return false; if (ShouldSkipType()) return false;
Expand Down
4 changes: 2 additions & 2 deletions src/ServiceStack.Text/JsConfig.cs
Expand Up @@ -90,7 +90,7 @@ public static bool ExcludeTypeInfo
[ThreadStatic] [ThreadStatic]
private static bool? tsForceTypeInfo; private static bool? tsForceTypeInfo;
private static bool? sForceTypeInfo; private static bool? sForceTypeInfo;
public static bool ForceTypeInfo public static bool IncludeTypeInfo
{ {
get get
{ {
Expand Down Expand Up @@ -489,7 +489,7 @@ public class JsConfig<T>
/// <summary> /// <summary>
/// Always emit type info for this type. Takes precedence over ExcludeTypeInfo /// Always emit type info for this type. Takes precedence over ExcludeTypeInfo
/// </summary> /// </summary>
public static bool ForceTypeInfo = false; public static bool IncludeTypeInfo = false;


/// <summary> /// <summary>
/// Never emit type info for this type /// Never emit type info for this type
Expand Down
Expand Up @@ -356,7 +356,7 @@ public class ExplicitPets
[Test] [Test]
public void Can_force_specific_TypeInfo() public void Can_force_specific_TypeInfo()
{ {
JsConfig<Dog>.ForceTypeInfo = true; JsConfig<Dog>.IncludeTypeInfo = true;
var pets = new ExplicitPets() var pets = new ExplicitPets()
{ {
Cat = new Cat { Name = "Cat" }, Cat = new Cat { Name = "Cat" },
Expand Down

0 comments on commit 9471011

Please sign in to comment.