How to insert rows of variable fields in azure table storage? RRS feed

  • Question

  • I would like to insert rows of variable fields for the same table. For example: 

    The 1st row for "User" table may have the following fields:

        RowKey, PartitionKey, Name, Address, Phone1

    and the 2nd row for "User" table may have different set of fields:

        RowKey, PartitionKey, Name, Phone1, Phone2


    I guess we can generate custom ATOM feed to manage insert/update. However, I was wondering if there is any C# API to do similar task?

    Monday, March 7, 2011 10:28 PM


  • You could use a TableServiceEntity-derived class containing a superset of both rows. Alternatively, you could use two TableServiceEntity-derived classes with some field indicating which one is correct for a given row. I did a post which goes into this in some detail including pointing out how to use the ReadingEntity and WritingEntity events to modify the serialization and deserialization of an entity to and from an Atom entry.
    • Marked as answer by Mog Liang Monday, March 14, 2011 9:43 AM
    Monday, March 7, 2011 10:52 PM