diff --git a/src/ServiceStack.Text/Common/WriteType.cs b/src/ServiceStack.Text/Common/WriteType.cs index c8f770ea9..321f2c0ac 100644 --- a/src/ServiceStack.Text/Common/WriteType.cs +++ b/src/ServiceStack.Text/Common/WriteType.cs @@ -28,9 +28,9 @@ internal static class WriteType internal static TypePropertyWriter[] PropertyWriters; private static readonly WriteObjectDelegate WriteTypeInfo; - private static bool IsForced + private static bool IsIncluded { - get { return (JsConfig.ForceTypeInfo || JsConfig.ForceTypeInfo); } + get { return (JsConfig.IncludeTypeInfo || JsConfig.IncludeTypeInfo); } } private static bool IsExcluded { @@ -41,7 +41,7 @@ static WriteType() { CacheFn = Init() ? GetWriteFn() : WriteEmptyType; - if (IsForced) + if (IsIncluded) { WriteTypeInfo = TypeInfoWriter; } @@ -60,7 +60,7 @@ public static void TypeInfoWriter(TextWriter writer, object obj) TryWriteTypeInfo(writer, obj); } - private static bool ShouldSkipType() { return IsExcluded && !IsForced; } + private static bool ShouldSkipType() { return IsExcluded && !IsIncluded; } private static bool TryWriteSelfType (TextWriter writer) { if (ShouldSkipType()) return false; diff --git a/src/ServiceStack.Text/JsConfig.cs b/src/ServiceStack.Text/JsConfig.cs index e818644b6..41394a8dc 100644 --- a/src/ServiceStack.Text/JsConfig.cs +++ b/src/ServiceStack.Text/JsConfig.cs @@ -90,7 +90,7 @@ public static bool ExcludeTypeInfo [ThreadStatic] private static bool? tsForceTypeInfo; private static bool? sForceTypeInfo; - public static bool ForceTypeInfo + public static bool IncludeTypeInfo { get { @@ -489,7 +489,7 @@ public class JsConfig /// /// Always emit type info for this type. Takes precedence over ExcludeTypeInfo /// - public static bool ForceTypeInfo = false; + public static bool IncludeTypeInfo = false; /// /// Never emit type info for this type diff --git a/tests/ServiceStack.Text.Tests/JsonTests/PolymorphicListTests.cs b/tests/ServiceStack.Text.Tests/JsonTests/PolymorphicListTests.cs index 65bdef6f3..f5e07a2e4 100644 --- a/tests/ServiceStack.Text.Tests/JsonTests/PolymorphicListTests.cs +++ b/tests/ServiceStack.Text.Tests/JsonTests/PolymorphicListTests.cs @@ -356,7 +356,7 @@ public class ExplicitPets [Test] public void Can_force_specific_TypeInfo() { - JsConfig.ForceTypeInfo = true; + JsConfig.IncludeTypeInfo = true; var pets = new ExplicitPets() { Cat = new Cat { Name = "Cat" },