當前位置: 首頁>>代碼示例>>C#>>正文


C# CloudTable.Exists方法代碼示例

本文整理匯總了C#中Microsoft.WindowsAzure.Storage.Table.CloudTable.Exists方法的典型用法代碼示例。如果您正苦於以下問題:C# CloudTable.Exists方法的具體用法?C# CloudTable.Exists怎麽用?C# CloudTable.Exists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Microsoft.WindowsAzure.Storage.Table.CloudTable的用法示例。


在下文中一共展示了CloudTable.Exists方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PopulateTableData

        private static void PopulateTableData(CloudTable cloudTable)
        {
            // if the table does not exist then create it and populate it wih some data
            if (!cloudTable.Exists())
            {
                cloudTable.CreateIfNotExists();

                var tableBatchOperation = new TableBatchOperation();
                for (int i = 0; i < 100; i++)
                {
                    tableBatchOperation.Add(
                        TableOperation.Insert(new Person(i.ToString(), string.Format("Person {0}", i))));
                }

                cloudTable.ExecuteBatch(tableBatchOperation);
            }
        }
開發者ID:linal,項目名稱:AzureStorageTableDemo,代碼行數:17,代碼來源:Program.cs

示例2: CloudDal

        public CloudDal()
        {
            // Retrieve the storage account from the connection string.
            CloudStorageAccount storageAccount = CloudStorageAccount.DevelopmentStorageAccount;

            // Create the table client.
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            // Create the table if it doesn't exist.
            table = tableClient.GetTableReference("people");
            if (table.Exists()==false)
            {
                table.Create();
            }
        }
開發者ID:learncity,項目名稱:ayklam,代碼行數:15,代碼來源:CloudDal.cs

示例3: DoesTableExist

 /// <summary>
 /// Checks whether the table exists.
 /// </summary>
 /// <param name="table">Cloud table object</param>
 /// <param name="requestOptions">Table request options</param>
 /// <param name="operationContext">Operation context</param>
 /// <returns>True if table exists; otherwise, false.</returns>
 public bool DoesTableExist(CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext)
 {
     return table.Exists(requestOptions, operationContext);
 }
開發者ID:docschmidt,項目名稱:azure-powershell,代碼行數:11,代碼來源:StorageTableManagement.cs

示例4: DeleteEntities

        public void DeleteEntities(CloudTable table, string partition = null)
        {
            if (!table.Exists())
            {
                return;
            }

            TableQuery query = new TableQuery();
            if (partition != null)
            {
                query.FilterString = string.Format("PartitionKey eq '{0}'", partition);
            }

            var entities = table.ExecuteQuery(query);

            if (entities.Any())
            {
                var batch = new TableBatchOperation();
                foreach (var entity in entities)
                {
                    batch.Delete(entity);
                }
                table.ExecuteBatch(batch);
            }
        }
開發者ID:Azure,項目名稱:azure-webjobs-sdk-script,代碼行數:25,代碼來源:EndToEndTestFixture.cs


注:本文中的Microsoft.WindowsAzure.Storage.Table.CloudTable.Exists方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。