For objects that expose an IDictionary<,> currently the deserializer requires a public property setter but ideally it should not - it should only require a public getter. The POCO type would create the dictionary itself (likely from within its constructor) and return it from the public getter.
Note that IList<> currently supports this mode of not having a setter.
Implementation support for this is incremental:
- Add a
IsPropertyDictionary to ReadStackFrame
- Add
PopStackOnEndObject to ReadStackFrame and use accordingly in JsonSerializer.HandleStartObject\HandleEndObject
- Modify
ApplyValueToEnumerable to handle the property case.
- Add tests for this including when there is a public setter but the dictionary is already initialized (we should just use the existing instance)
- ...
For objects that expose an IDictionary<,> currently the deserializer requires a public property setter but ideally it should not - it should only require a public getter. The POCO type would create the dictionary itself (likely from within its constructor) and return it from the public getter.
Note that IList<> currently supports this mode of not having a setter.
Implementation support for this is incremental:
IsPropertyDictionaryto ReadStackFramePopStackOnEndObjectto ReadStackFrame and use accordingly in JsonSerializer.HandleStartObject\HandleEndObjectApplyValueToEnumerableto handle the property case.