A unified Windows Azure Storage SDK for .net Microframework v4.2.
Install the following components:
- Microsoft Visual C# Express 2010
- .NET Micro Framework SDK v4.2
- Netduino SDK v4.2.2.0 (32-bit) or Netduino SDK v4.2.2.0 (64-bit)
Create an instance of TableClient
with your storage account and key:
var client = new TableClient(new CloudStorageAccount(account,key));
The client can be used to create a table:
client.CreateTable("helloworld");
To insert new entities, create a Hashtable
with the values you wish to store:
var values = new Hashtable();
values.Add("guidfield", Guid.NewGuid());
values.Add("int32field", 32);
values.Add("stringfield", "string");
values.Add("doublefield", (double)123.22);
values.Add("int64field", (Int64)64);
values.Add("boolfield", true);
client.InsertTableEntity("helloworld", "PK", "RK", DateTime.Now, values);
You can query for a single entity, which will return a single Hashtable
containing all the entity properties:
var entity = client.QueryTable("helloworld", "PK", "RK");
Or you can pass in an OData query, and get an array of Hashtables back:
var entities = client.QueryTable("helloworld", "PartitionKey eq 'PK'");
Delete an entity:
client.DeleteTableEntity("helloworld", "PK", "RK");