locked
New Property in Azure Development Storage RRS feed

  • Question

  • Hi - I have a storage table that contained 20 rows for a simple class, containing 5 properties.  This is using development storage running on SQL Server 2008.

    I added a new boolean property to the class and started to save new rows into the table.  I noticed that new rows contained either 'true' or 'false' but old rows contained blank entries. 

    When I query this table through a table service context using CreateQuery, I get an error message telling me about a null object.  I believe it is related to the 'null' entries for the boolean property in the table.  I expected the property to default to false. 

    Is there a setting on the table service context, or a parameter on the CreateQuery call or something to deal with this?

    Thanks for reading.

    Friday, August 27, 2010 11:32 AM

Answers

  • Hi Paul,

    Have you try nullable value for your new created property and additionally, you can add default value to it.

    for example:

    private bool? newProperty = false;
    

    Regards,

    Wely

    • Marked as answer by Yi-Lun Luo Thursday, September 2, 2010 9:06 AM
    Friday, August 27, 2010 12:55 PM
  • When I query this table through a table service context using CreateQuery, I get an error message telling me about a null object.  I believe it is related to the 'null' entries for the boolean property in the table.  I expected the property to default to false. 

    Azure Table Services are schemaless so each entity can have a completely different schema. On retrieval of data the Storage Client API initializes non-existent data to null - a good representation of data that does not, in fact, exist.

    • Marked as answer by Yi-Lun Luo Thursday, September 2, 2010 9:06 AM
    Friday, August 27, 2010 2:51 PM
    Answerer

All replies

  • Hi Paul,

    Have you try nullable value for your new created property and additionally, you can add default value to it.

    for example:

    private bool? newProperty = false;
    

    Regards,

    Wely

    • Marked as answer by Yi-Lun Luo Thursday, September 2, 2010 9:06 AM
    Friday, August 27, 2010 12:55 PM
  • When I query this table through a table service context using CreateQuery, I get an error message telling me about a null object.  I believe it is related to the 'null' entries for the boolean property in the table.  I expected the property to default to false. 

    Azure Table Services are schemaless so each entity can have a completely different schema. On retrieval of data the Storage Client API initializes non-existent data to null - a good representation of data that does not, in fact, exist.

    • Marked as answer by Yi-Lun Luo Thursday, September 2, 2010 9:06 AM
    Friday, August 27, 2010 2:51 PM
    Answerer