Skip to content

Instantly share code, notes, and snippets.

@sandrinodimattia
Created November 15, 2012 21:59
Show Gist options
  • Save sandrinodimattia/4081602 to your computer and use it in GitHub Desktop.
Save sandrinodimattia/4081602 to your computer and use it in GitHub Desktop.
New Table Storage SDK
public class Customer : TableEntity
{
public string Name { get; set; }
}
static void CreateCustomers()
{
// Get the customers table.
CloudStorageAccount storageAccount = new CloudStorageAccount(new StorageCredentials(accountName, accountKey), false);
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
CloudTable customersTable = tableClient.GetTableReference("customers");
customersTable.CreateIfNotExists();
// Add 2 customers.
var customer1 = new Customer() { PartitionKey = "", RowKey = "MSFT", Name = "Microsoft" };
customersTable.Execute(TableOperation.Insert(customer1));
var customer2 = new Customer() { PartitionKey = "", RowKey = "GOOG", Name = "Google" };
customersTable.Execute(TableOperation.Insert(customer2));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment