在 Windows Azure 存储中,我们曾经这样做来创建表:
var tableClient = account.CreateCloudTableClient();
tableClient.CreateTableIfNotExist(TableName);
我刚刚下载了最后一个版本的 azure 存储库 (v2),我之前的代码不再起作用:
'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.
v2 中的好代码是什么?
最佳答案
在 v2 中存在一些重大更改。 这是新代码:
var tableClient = account.CreateCloudTableClient();
// Create the table if it doesn't exist.
var cloudTable = tableClient.GetTableReference(TableName);
cloudTable.CreateIfNotExists();
一些好的输入:
- 如何使用表存储服务:见 v1.7并在 v2 .
- Windows Azure Storage Client Library 2.0 Breaking Changes & Migration Guide来自 Azure 存储团队
关于c# - AzureStorage 库 v2 中的 "tableClient.CreateTableIfNotExist"在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13647479/