How do I change the default Type for Numeric deserialization?

后端 未结 4 1722
抹茶落季
抹茶落季 2020-11-30 05:10

I\'m deserializing some properties to a Dictionary.

When I deserialize some json, it populates the Dictionary with <

4条回答
  •  孤街浪徒
    2020-11-30 05:30

    I'm accepting Enzi's answer since it's what I was asking for.

    However, since then I've changed my strategy.

    Right now I'm deserializing to a ChangeSet which instead of the dictionary has a strongly typed Entity (T) object with the changes. It also has a List with the property names of the properties that was present in the incoming json. I then populate that list during deserialization using a custom MediaFormatter. That way I get a strongly typed object and correct deserialization of all properties, and I know from the list what properties I should set on my collection of T when I want to do my batch operation.

    This way I basically use my entities as DTO's without having to have a myriad of different DTO's for different batch operations. Is pretty sleek if I do say so myself. :)

提交回复
热议问题