ExtensionDataObject #17

Open
esbenbach opened this Issue Jan 25, 2012 · 0 comments

Comments

Projects
None yet
1 participant

Using the JsonReader with the DataContractResolverStrategy the serializers does not seem to serialize into the ExtensionDataObject if the contract implements IExtensibleDataObject.

In terms of code:

using (StreamReader reader = new StreamReader("some stream here"))
{
  DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(SomeContract));
  var serializedItem = (SomeContract)serializer.ReadObject(reader.BaseStream);

  JsonReader jsonReader = new JsonReader(new DataReaderSettings(new DataContractResolverStrategy()));
  var otherSerializedItem = jsonReader.Read<SomeContract>(reader.ReadToEnd());
}

The serializedItem and otherSerializedItem will not be the same as the serializedItem will have all the unknown values in the ExtensionDataObject defined in the contract.

I don't know if this would be a desired feature, an option to the resolver strategy or whatnot - but I find it odd that the two produces different results (and I for one finds it a usefull feature).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment