-patch signatures in DefaultContractResolver to use arrays

This commit is contained in:
Paul Betts
2013-02-12 01:51:44 -08:00
parent 3e93c38132
commit 7cc5d306d1
@@ -550,11 +550,11 @@ namespace Newtonsoft.Json.Serialization
if (t.BaseType() != null) if (t.BaseType() != null)
ResolveCallbackMethods(contract, t.BaseType()); ResolveCallbackMethods(contract, t.BaseType());
MethodInfo onSerializing; List<MethodInfo> onSerializing;
MethodInfo onSerialized; List<MethodInfo> onSerialized;
MethodInfo onDeserializing; List<MethodInfo> onDeserializing;
MethodInfo onDeserialized; List<MethodInfo> onDeserialized;
MethodInfo onError; List<MethodInfo> onError;
GetCallbackMethodsForType(t, out onSerializing, out onSerialized, out onDeserializing, out onDeserialized, out onError); GetCallbackMethodsForType(t, out onSerializing, out onSerialized, out onDeserializing, out onDeserialized, out onError);
@@ -562,34 +562,34 @@ namespace Newtonsoft.Json.Serialization
{ {
#if NETFX_CORE #if NETFX_CORE
if (!t.IsGenericType() || (t.GetGenericTypeDefinition() != typeof(ConcurrentDictionary<,>))) if (!t.IsGenericType() || (t.GetGenericTypeDefinition() != typeof(ConcurrentDictionary<,>)))
contract.OnSerializing = onSerializing; contract.OnSerializingMethods = onSerializing;
#else #else
contract.OnSerializing = onSerializing; contract.OnSerializingMethods = onSerializing;
#endif #endif
} }
if (onSerialized != null) if (onSerialized != null)
contract.OnSerialized = onSerialized; contract.OnSerializedMethods = onSerialized;
if (onDeserializing != null) if (onDeserializing != null)
contract.OnDeserializing = onDeserializing; contract.OnDeserializingMethods = onDeserializing;
if (onDeserialized != null) if (onDeserialized != null)
{ {
// ConcurrentDictionary throws an error here so don't use its OnDeserialized - http://json.codeplex.com/discussions/257093 // ConcurrentDictionary throws an error here so don't use its OnDeserialized - http://json.codeplex.com/discussions/257093
#if !(NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE) #if !(NET35 || NET20 || SILVERLIGHT || WINDOWS_PHONE || PORTABLE)
if (!t.IsGenericType() || (t.GetGenericTypeDefinition() != typeof(ConcurrentDictionary<,>))) if (!t.IsGenericType() || (t.GetGenericTypeDefinition() != typeof(ConcurrentDictionary<,>)))
contract.OnDeserialized = onDeserialized; contract.OnDeserializedMethods = onDeserialized;
#else #else
contract.OnDeserialized = onDeserialized; contract.OnDeserializedMethods = onDeserialized;
#endif #endif
} }
if (onError != null) if (onError != null)
contract.OnError = onError; contract.OnErrorMethods = onError;
} }
private void GetCallbackMethodsForType(Type type, out MethodInfo onSerializing, out MethodInfo onSerialized, out MethodInfo onDeserializing, out MethodInfo onDeserialized, out MethodInfo onError) private void GetCallbackMethodsForType(Type type, out List<MethodInfo> onSerializing, out List<MethodInfo> onSerialized, out List<MethodInfo> onDeserializing, out List<MethodInfo> onDeserialized, out List<MethodInfo> onError)
{ {
onSerializing = null; onSerializing = null;
onSerialized = null; onSerialized = null;