Merge 10 branches on propertyAttribute != null into one. (#1149)
This commit is contained in:
committed by
James Newton-King
parent
f4c17aedb2
commit
cc7f5d80eb
@@ -1490,16 +1490,39 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
property.Order = propertyAttribute._order;
|
property.Order = propertyAttribute._order;
|
||||||
property.DefaultValueHandling = propertyAttribute._defaultValueHandling;
|
property.DefaultValueHandling = propertyAttribute._defaultValueHandling;
|
||||||
hasMemberAttribute = true;
|
hasMemberAttribute = true;
|
||||||
|
property.NullValueHandling = propertyAttribute._nullValueHandling;
|
||||||
|
property.ReferenceLoopHandling = propertyAttribute._referenceLoopHandling;
|
||||||
|
property.ObjectCreationHandling = propertyAttribute._objectCreationHandling;
|
||||||
|
property.TypeNameHandling = propertyAttribute._typeNameHandling;
|
||||||
|
property.IsReference = propertyAttribute._isReference;
|
||||||
|
|
||||||
|
property.ItemIsReference = propertyAttribute._itemIsReference;
|
||||||
|
property.ItemConverter = propertyAttribute.ItemConverterType != null ? JsonTypeReflector.CreateJsonConverterInstance(propertyAttribute.ItemConverterType, propertyAttribute.ItemConverterParameters) : null;
|
||||||
|
property.ItemReferenceLoopHandling = propertyAttribute._itemReferenceLoopHandling;
|
||||||
|
property.ItemTypeNameHandling = propertyAttribute._itemTypeNameHandling;
|
||||||
}
|
}
|
||||||
#if !NET20
|
else
|
||||||
else if (dataMemberAttribute != null)
|
|
||||||
{
|
{
|
||||||
property._required = (dataMemberAttribute.IsRequired) ? Required.AllowNull : Required.Default;
|
property.NullValueHandling = null;
|
||||||
property.Order = (dataMemberAttribute.Order != -1) ? (int?)dataMemberAttribute.Order : null;
|
property.ReferenceLoopHandling = null;
|
||||||
property.DefaultValueHandling = (!dataMemberAttribute.EmitDefaultValue) ? (DefaultValueHandling?)DefaultValueHandling.Ignore : null;
|
property.ObjectCreationHandling = null;
|
||||||
hasMemberAttribute = true;
|
property.TypeNameHandling = null;
|
||||||
}
|
property.IsReference = null;
|
||||||
|
property.ItemIsReference = null;
|
||||||
|
property.ItemConverter = null;
|
||||||
|
property.ItemReferenceLoopHandling = null;
|
||||||
|
property.ItemTypeNameHandling = null;
|
||||||
|
#if !NET20
|
||||||
|
if (dataMemberAttribute != null)
|
||||||
|
{
|
||||||
|
property._required = (dataMemberAttribute.IsRequired) ? Required.AllowNull : Required.Default;
|
||||||
|
property.Order = (dataMemberAttribute.Order != -1) ? (int?)dataMemberAttribute.Order : null;
|
||||||
|
property.DefaultValueHandling = (!dataMemberAttribute.EmitDefaultValue) ? (DefaultValueHandling?)DefaultValueHandling.Ignore : null;
|
||||||
|
hasMemberAttribute = true;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (requiredAttribute != null)
|
if (requiredAttribute != null)
|
||||||
{
|
{
|
||||||
property._required = Required.Always;
|
property._required = Required.Always;
|
||||||
@@ -1545,20 +1568,6 @@ namespace Newtonsoft.Json.Serialization
|
|||||||
property.DefaultValue = defaultValueAttribute.Value;
|
property.DefaultValue = defaultValueAttribute.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
property.NullValueHandling = (propertyAttribute != null) ? propertyAttribute._nullValueHandling : null;
|
|
||||||
property.ReferenceLoopHandling = (propertyAttribute != null) ? propertyAttribute._referenceLoopHandling : null;
|
|
||||||
property.ObjectCreationHandling = (propertyAttribute != null) ? propertyAttribute._objectCreationHandling : null;
|
|
||||||
property.TypeNameHandling = (propertyAttribute != null) ? propertyAttribute._typeNameHandling : null;
|
|
||||||
property.IsReference = (propertyAttribute != null) ? propertyAttribute._isReference : null;
|
|
||||||
|
|
||||||
property.ItemIsReference = (propertyAttribute != null) ? propertyAttribute._itemIsReference : null;
|
|
||||||
property.ItemConverter =
|
|
||||||
(propertyAttribute?.ItemConverterType != null)
|
|
||||||
? JsonTypeReflector.CreateJsonConverterInstance(propertyAttribute.ItemConverterType, propertyAttribute.ItemConverterParameters)
|
|
||||||
: null;
|
|
||||||
property.ItemReferenceLoopHandling = (propertyAttribute != null) ? propertyAttribute._itemReferenceLoopHandling : null;
|
|
||||||
property.ItemTypeNameHandling = (propertyAttribute != null) ? propertyAttribute._itemTypeNameHandling : null;
|
|
||||||
|
|
||||||
allowNonPublicAccess = false;
|
allowNonPublicAccess = false;
|
||||||
#pragma warning disable 618
|
#pragma warning disable 618
|
||||||
if ((DefaultMembersSearchFlags & BindingFlags.NonPublic) == BindingFlags.NonPublic)
|
if ((DefaultMembersSearchFlags & BindingFlags.NonPublic) == BindingFlags.NonPublic)
|
||||||
|
|||||||
Reference in New Issue
Block a user