c# - AzureStorage 库 v2 中的 "tableClient.CreateTableIfNotExist"在哪里?

标签 c# azure azure-table-storage azure-storage

在 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();

一些好的输入:

关于c# - AzureStorage 库 v2 中的 "tableClient.CreateTableIfNotExist"在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13647479/

相关文章:

azure - windows azure 表存储,如何启用保持事件状态

c# - PropertieInfo 的 GetValue 抛出 TargetParameterCountException (System.Reflection)

c# - ASP.NET MVC 连接名称并映射到 ID#

c# - Windows Phone 开发 - IsolatedStorage

asp.net - HttpModule EndRequest 处理程序被调用两次

azure - 如何自动启动Azure VM?

java - 在 Azure Media Encoder Standard 中向作业添加多个 InputMediaAsset 会导致 400

c# - Azure 存储表中的 InsertOrUpdate 与 InsertOrMerge,有什么区别?

c# - MediatR 共享 TableBatchOperation 以在不同的处理程序中进行事务保存

c# - 在哪里复制 gsdll32.dll 以使 PDF 到图像转换器在我的 WPF 应用程序中工作?