1
votes

i am trying to add an order entity to an Azure table. When i add the entity it only adds the values for partition key and row key. Any help is much appreciated. Here is my code.

class OrderEntity : TableServiceEntity
{
    public int customerID;
    public int productID;
    public Double price;
    public String status;
}

Then in a seperate class

        OrderEntity order = new OrderEntity();
        order.customerID = retrievedCustomer.id;
        order.productID = selectedProduct.id;
        order.price = Convert.ToDouble(selectedProduct.price);
        order.PartitionKey = retrievedCustomer.id.ToString();
        order.RowKey = counter.ToString();
        order.status = "Processing Order";

        serviceContext.AddObject("orders", order);

        // Submit the operation to the table service
        serviceContext.SaveChangesWithRetries();
2

2 Answers

4
votes

You need to use properties instead of public fields.

2
votes

Mark Rendle is correct, only public properties are supported and not fields.

Because I ran into limitations on the Microsoft client, I have written an alternate Azure table storage client, Lucifure Stash, with many high level abstractions. Lucifure Stash, supports data columns > 64K, lists, arrays, enumerations, serialization, morphing, public and private properties and fields and more. It is free for personal use and can be downloaded from http://www.lucifure.com or via NuGet.com.