Starting with a table
Using the connection string defined in the App.config
file, we will proceed to create a CloudStorageAccount
object which represents the storage account where the tables will be created. After that we need to use the CloudTableClient
class, which is defined under the Microsoft.WindowsAzure.Storage.Table
namespace, to create an object which represents a frontage for dealing with Table storage specifically and directly.
After creating the table object we will call its CreateIfNotExists()
method that will actually call the Table REST API to create a table. The method is idempotent: if the table already exists, the method will do nothing no matter how many times you call it.
The following is the code to do create a table:
string connectionString = ConfigurationManager.AppSettings["StorageConnectionString"]; CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString); CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); CloudTable...