0

I'm sending a Microsoft.Azure.CosmosDB.Table.TableEntity with an enum field and when it makes to cosmosdb the enum field has been dropped. So I think this happens because it's not a native type and serialization is messing up.

What is the right way of doing this?

Do I need to override ReadEntity and WriteEntity or is there any other way? I'm thinking there ought to be something like Newtonsoft's

[JsonConverter(typeof(StringEnumConverter))] attribute.

  • please provide the code snippet – Darshan Dave Mar 08 '18 at 06:54
  • If you need the enum to be stored as a string then include those attribute against the property in your class. Also, refer this stackoverflow https://stackoverflow.com/questions/2441290/json-serialization-of-enum-as-string – Aravinth Kannan Mar 08 '18 at 12:40

1 Answers1

0

You could try TableEntity.Flatten and TableEntity.ConvertBack. For what it's worth, especially if you call base.ReadEntity and base.WriteEntity, I don't think overriding Read and Write entity is an inelegant solution.

Harshita Gupta
  • 460
  • 3
  • 10