BitArray in Azure Table Storage RRS feed

  • Question

  • Environment: Windows Azure v1.1, ASP.NET 3.5, C#, JavaScript, VS2008 SP1

    I have a simple Azure Table (TableServiceEntity) with the following columns (in addtion to Partition key/Row key/Timestamp)
    public double Reputation { get; set; }
    public int Badges { get; set; }
    public BitArray BitArrayBadges { get; set; }

    I want to insert a new record roughly as follows:
    from my create-record method...

    int userId = "100200300"; // I generate a unique string for each method call
    BitArray bitArrayBadges = new BitArray(13, false);
    int badges = 0;
    MyDataSource urds = new MyDataSource();     // contains CloudStorageAccount and TableServiceContext instances
    MyDataModel urdm = new MyDataModel(userID); // derived from TableServiceEntity
    urdm.BitArrayBadges = bitArrayBadges;
    urdm.Badges = badges; // no badges initially
    urdm.Reputation = 0.0;

    The insert method (below), fails on SaveChanges
    public void Insert(MyDataModel newItem)
         _ServiceContext.AddObject(MyTableServiceContext.UserReputationTableName, newItem);
    with the following stack trace
    "System.InvalidOperationException: The type 'System.Object' has no settable properties.\r\n  
    at System.Data.Services.Client.ClientType..ctor(Type type, String typeName, Boolean skipSettableCheck)\r\n  
    at System.Data.Services.Client.ClientType.Create(Type type, Boolean expectModelType)\r\n  
    at System.Data.Services.Client.ClientType.Create(Type type)\r\n  
    at System.Data.Services.Client.DataServiceContext.WriteContentProperties(XmlWriter writer, ClientType type, Object resource)\r\n  
    at System.Data.Services.Client.DataServiceContext.WriteContentProperties(XmlWriter writer, ClientType type, Object resource)\r\n  
    at System.Data.Services.Client.DataServiceContext.CreateRequestData(ResourceBox box, Boolean newline)\r\n  
    at System.Data.Services.Client.DataServiceContext.SaveAsyncResult.CreateChangeData(Int32 index, Boolean newline)\r\n  
    at System.Data.Services.Client.DataServiceContext.SaveAsyncResult.BeginNextChange(Boolean replaceOnUpdate)\r\n\r\n" 

    If I change my TableServiceEntity (MyDataModel) by removing BitArrayBadges (and not setting it in my method before Save), then all is well.

    Can I have a BitArray firld in my TableServiceEntity? If so, how do I best change my approach?

    Thursday, August 19, 2010 7:42 PM


All replies

  • The supported Table Service datatypes are:

    • Boolean
    • Byte[]
    • DateTime
    • Double
    • Int32
    • Int64
    • String

    BitArray is not supported.

    Thursday, August 19, 2010 8:19 PM
  • Thanks Neil.

    (It would be nice if VS2008 gave me a better design-time indication of the incompatibility though ;)

    Friday, August 20, 2010 4:09 PM