哪里" tableClient.CreateTableIfNotExist"在AzureStorage库V2? [英] Where is the "tableClient.CreateTableIfNotExist" in AzureStorage library v2?

查看:204
本文介绍了哪里" tableClient.CreateTableIfNotExist"在AzureStorage库V2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows Azure存储,以前我们这样做是为了创建一个表:

In Windows Azure Storage, we used to do this to create a table :

var tableClient = account.CreateCloudTableClient();
tableClient.CreateTableIfNotExist(TableName);

我刚刚下载的Azure存储库(V2)的最后一个版本,我的previous code不工作了:

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'不
  包含CreateTableIfNotExist'没有扩展名的定义
  方法CreateTableIfNotExist接受式的第一个参数
  Microsoft.WindowsAzure.Storage.Table.CloudTableClient'可以找到。

'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良好的code?

What is the good code in v2 ?

推荐答案

在V2有一些重大的变动。
这里是新的code:

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

一些好的输入:

  • How to use the Table Storage Service : in v1.7 and in v2.
  • Windows Azure Storage Client Library 2.0 Breaking Changes & Migration Guide from the Azure Storage Team

这篇关于哪里" tableClient.CreateTableIfNotExist"在AzureStorage库V2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆