Created
November 15, 2012 21:59
-
-
Save sandrinodimattia/4081602 to your computer and use it in GitHub Desktop.
New Table Storage SDK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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