19 April 2011

Azure - Supported data types in storage tables

In Windows Azure, to insert an object in a table, you do this:

TableServiceContext tableContext = tableClient.GetDataServiceContext();
tableContext.AddObject("Products",
                       new Product() { PartitionKey = "SynProd",
                                       RowKey = Guid.NewGuid().ToString(),
                                       Name = "EGS Database Tool 1.0.2.0",
                                       PurchasePrice = 1400.50m });
tableContext.SaveChanges();

That gave me the error
One of the request inputs is not valid
because of the decimal value in the object. Those are not yet supported in tables.
When I changed it into a double value it worked.

Here are the currently supported types in Azure Table Service:

ADO.NET               CLR          Detail
Edm.Binary            byte[]       Max. 64 kB
Edm.Boolean           bool
Edm.DateTime          DateTime     64-bit UTC 01 jan 1601 0:00 - 31 dec 9999
Edm.Double            double       64-bit
Edm.Guid              Guid         128-bit
Edm.Int32             int          32-bit
Edm.Int64             Int64        64-bit
Edm.String            string       Max. 64 kB, UTF-16 encoded

No comments:

Post a Comment