-Added support for serializing extension data

-Added support for reference loop handling and type name handling to extension data
-Bug fixes
This commit is contained in:
James Newton-King
2013-10-06 12:32:56 +13:00
parent 23cc86837e
commit 3536c76873
10 changed files with 434 additions and 69 deletions
@@ -1733,7 +1733,7 @@ To fix this error either change the environment to be fully trusted, change the
if (!reader.Read())
break;
SetExtensionData(contract, reader, memberName, newObject);
SetExtensionData(contract, member, reader, memberName, newObject);
continue;
}
@@ -1749,7 +1749,7 @@ To fix this error either change the environment to be fully trusted, change the
// set extension data if property is ignored or readonly
if (!SetPropertyValue(property, propertyConverter, contract, member, reader, newObject))
SetExtensionData(contract, reader, memberName, newObject);
SetExtensionData(contract, member, reader, memberName, newObject);
}
catch (Exception ex)
{
@@ -1780,15 +1780,15 @@ To fix this error either change the environment to be fully trusted, change the
return newObject;
}
private void SetExtensionData(JsonObjectContract contract, JsonReader reader, string memberName, object o)
private void SetExtensionData(JsonObjectContract contract, JsonProperty member, JsonReader reader, string memberName, object o)
{
if (contract.ExtensionDataSetter != null)
{
try
{
JToken extensionDataValue = JToken.ReadFrom(reader);
object value = CreateValueInternal(reader, null, null, null, contract, member, null);
contract.ExtensionDataSetter(o, memberName, extensionDataValue);
contract.ExtensionDataSetter(o, memberName, value);
}
catch (Exception ex)
{