How to add new properties to an entity saved in Azure Table Storage?

前端 未结 1 1363
抹茶落季
抹茶落季 2021-01-28 17:58

I am working with an application where a .NET type derived from TableServiceObject being saved to Azure Table Storage (call it \"Person\") has a collection of another entity (\"

相关标签:
1条回答
  • 2021-01-28 18:16

    I'm assuming you're using .NET, because you mentioned classes mapping to entities in tables. Table storage itself has no schema, so this is a complete non-issue.

    Using the WCF Data Services client library (what's underneath Microsoft.WindowsAzure.Storage) without a schema is a bit tricky. Search for ReadingEntity and WritingEntity relating to table storage, and you'll probably find what you need. Essentially, you need to hook these events and parse (or inject) the extra properties you want. People usually do this by creating a dictionary property to handle those "extra" properties and then read and write them when those events fire.

    You might also check out http://www.lucifure.com/, an alternative client library that I have no experience with. I believe it addresses this limitation too: "Dynamic stashing via a dictionary, so you do not have to map every table property to a class member."

    0 讨论(0)
提交回复
热议问题