Reputation: 8319
In Windows Azure Storage, we used to do this to create a table :
var tableClient = account.CreateCloudTableClient();
tableClient.CreateTableIfNotExist(TableName);
I just downloaded the last version of the azure storage library (v2), and my previous code doesn't work anymore :
'Microsoft.WindowsAzure.Storage.Table.CloudTableClient' does not contain a definition for 'CreateTableIfNotExist' and no extension method 'CreateTableIfNotExist' accepting a first argument of type 'Microsoft.WindowsAzure.Storage.Table.CloudTableClient' could be found.
What is the good code in v2 ?
Upvotes: 11
Views: 6249
Reputation: 8319
In v2 there's some breaking changes. Here's the new code :
var tableClient = account.CreateCloudTableClient();
// Create the table if it doesn't exist.
var cloudTable = tableClient.GetTableReference(TableName);
cloudTable.CreateIfNotExists();
Some good inputs :
Upvotes: 25