-Obsolete DefaultContractResolver(bool)
This commit is contained in:
@@ -57,4 +57,4 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("7.0.0.0")]
|
[assembly: AssemblyVersion("7.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("7.0.1.18216")]
|
[assembly: AssemblyFileVersion("7.0.1.18304")]
|
||||||
|
|||||||
@@ -76,4 +76,4 @@ using System.Security;
|
|||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
[assembly: AssemblyVersion("7.0.0.0")]
|
[assembly: AssemblyVersion("7.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("7.0.1.18216")]
|
[assembly: AssemblyFileVersion("7.0.1.18304")]
|
||||||
|
|||||||
@@ -344,7 +344,9 @@ namespace Newtonsoft.Json.Tests.Schema
|
|||||||
public class CustomDirectoryInfoMapper : DefaultContractResolver
|
public class CustomDirectoryInfoMapper : DefaultContractResolver
|
||||||
{
|
{
|
||||||
public CustomDirectoryInfoMapper()
|
public CustomDirectoryInfoMapper()
|
||||||
|
#pragma warning disable 612
|
||||||
: base(true)
|
: base(true)
|
||||||
|
#pragma warning restore 612
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,9 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
private readonly char _startingWithChar;
|
private readonly char _startingWithChar;
|
||||||
|
|
||||||
public DynamicContractResolver(char startingWithChar)
|
public DynamicContractResolver(char startingWithChar)
|
||||||
|
#pragma warning disable 612
|
||||||
: base(false)
|
: base(false)
|
||||||
|
#pragma warning restore 612
|
||||||
{
|
{
|
||||||
_startingWithChar = startingWithChar;
|
_startingWithChar = startingWithChar;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4167,7 +4167,7 @@ Path '', line 1, position 1.");
|
|||||||
|
|
||||||
string json = JsonConvert.SerializeObject(value, new JsonSerializerSettings
|
string json = JsonConvert.SerializeObject(value, new JsonSerializerSettings
|
||||||
{
|
{
|
||||||
ContractResolver = new DefaultContractResolver(false)
|
ContractResolver = new DefaultContractResolver
|
||||||
{
|
{
|
||||||
IgnoreSerializableInterface = true
|
IgnoreSerializableInterface = true
|
||||||
}
|
}
|
||||||
@@ -4177,7 +4177,7 @@ Path '', line 1, position 1.");
|
|||||||
|
|
||||||
value = JsonConvert.DeserializeObject<ISerializableTestObject>("{booleanValue:true}", new JsonSerializerSettings
|
value = JsonConvert.DeserializeObject<ISerializableTestObject>("{booleanValue:true}", new JsonSerializerSettings
|
||||||
{
|
{
|
||||||
ContractResolver = new DefaultContractResolver(false)
|
ContractResolver = new DefaultContractResolver
|
||||||
{
|
{
|
||||||
IgnoreSerializableInterface = true
|
IgnoreSerializableInterface = true
|
||||||
}
|
}
|
||||||
@@ -7060,8 +7060,8 @@ Path '', line 1, position 1.");
|
|||||||
where T : class
|
where T : class
|
||||||
{
|
{
|
||||||
var stringWriter = new StringWriter();
|
var stringWriter = new StringWriter();
|
||||||
var serializer = new Newtonsoft.Json.JsonSerializer();
|
var serializer = new JsonSerializer();
|
||||||
serializer.ContractResolver = new DefaultContractResolver(false)
|
serializer.ContractResolver = new DefaultContractResolver
|
||||||
{
|
{
|
||||||
IgnoreSerializableAttribute = false
|
IgnoreSerializableAttribute = false
|
||||||
};
|
};
|
||||||
@@ -7073,9 +7073,9 @@ Path '', line 1, position 1.");
|
|||||||
private T Deserialize<T>(string json)
|
private T Deserialize<T>(string json)
|
||||||
where T : class
|
where T : class
|
||||||
{
|
{
|
||||||
var jsonReader = new Newtonsoft.Json.JsonTextReader(new StringReader(json));
|
var jsonReader = new JsonTextReader(new StringReader(json));
|
||||||
var serializer = new Newtonsoft.Json.JsonSerializer();
|
var serializer = new JsonSerializer();
|
||||||
serializer.ContractResolver = new DefaultContractResolver(false)
|
serializer.ContractResolver = new DefaultContractResolver
|
||||||
{
|
{
|
||||||
IgnoreSerializableAttribute = false
|
IgnoreSerializableAttribute = false
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -92,5 +92,5 @@ using System.Security;
|
|||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
[assembly: AssemblyVersion("7.0.0.0")]
|
[assembly: AssemblyVersion("7.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("7.0.1.18216")]
|
[assembly: AssemblyFileVersion("7.0.1.18304")]
|
||||||
[assembly: CLSCompliant(true)]
|
[assembly: CLSCompliant(true)]
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
/// Initializes a new instance of the <see cref="CamelCasePropertyNamesContractResolver"/> class.
|
/// Initializes a new instance of the <see cref="CamelCasePropertyNamesContractResolver"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public CamelCasePropertyNamesContractResolver()
|
public CamelCasePropertyNamesContractResolver()
|
||||||
|
#pragma warning disable 612
|
||||||
: base(true)
|
: base(true)
|
||||||
|
#pragma warning restore 612
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,9 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class DefaultContractResolver : IContractResolver
|
public class DefaultContractResolver : IContractResolver
|
||||||
{
|
{
|
||||||
|
#pragma warning disable 612
|
||||||
private static readonly IContractResolver _instance = new DefaultContractResolver(true);
|
private static readonly IContractResolver _instance = new DefaultContractResolver(true);
|
||||||
|
#pragma warning restore 612
|
||||||
|
|
||||||
internal static IContractResolver Instance
|
internal static IContractResolver Instance
|
||||||
{
|
{
|
||||||
@@ -187,8 +189,15 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
/// Initializes a new instance of the <see cref="DefaultContractResolver"/> class.
|
/// Initializes a new instance of the <see cref="DefaultContractResolver"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DefaultContractResolver()
|
public DefaultContractResolver()
|
||||||
: this(false)
|
|
||||||
{
|
{
|
||||||
|
#if !NETFX_CORE
|
||||||
|
#pragma warning disable 618
|
||||||
|
DefaultMembersSearchFlags = BindingFlags.Public | BindingFlags.Instance;
|
||||||
|
#pragma warning restore 618
|
||||||
|
#endif
|
||||||
|
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||||
|
IgnoreSerializableAttribute = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -200,17 +209,10 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
/// happen once. This setting can cause unexpected behavior if different instances of the resolver are suppose to produce different
|
/// happen once. This setting can cause unexpected behavior if different instances of the resolver are suppose to produce different
|
||||||
/// results. When set to false it is highly recommended to reuse <see cref="DefaultContractResolver"/> instances with the <see cref="JsonSerializer"/>.
|
/// results. When set to false it is highly recommended to reuse <see cref="DefaultContractResolver"/> instances with the <see cref="JsonSerializer"/>.
|
||||||
/// </param>
|
/// </param>
|
||||||
|
[ObsoleteAttribute("DefaultContractResolver(bool) is obsolete. Use the parameterless constructor and cache instances of the contract resolver within your application for optimal performance.")]
|
||||||
public DefaultContractResolver(bool shareCache)
|
public DefaultContractResolver(bool shareCache)
|
||||||
|
: this()
|
||||||
{
|
{
|
||||||
#if !NETFX_CORE
|
|
||||||
#pragma warning disable 618
|
|
||||||
DefaultMembersSearchFlags = BindingFlags.Public | BindingFlags.Instance;
|
|
||||||
#pragma warning restore 618
|
|
||||||
#endif
|
|
||||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
|
||||||
IgnoreSerializableAttribute = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_sharedCache = shareCache;
|
_sharedCache = shareCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user