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


C# Table.CloudTableClient類代碼示例

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


CloudTableClient類屬於Microsoft.WindowsAzure.Storage.Table命名空間,在下文中一共展示了CloudTableClient類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Tracker

        public Tracker(string accountName, string keyValue)
        {
            _applicationId = IdUtil.ApplicationId();
            _deviceId = IdUtil.DeviceId();
            _anid = IdUtil.GetAnidFromOs();
            _appTitle = IdUtil.ApplicationName();
            _adsRefreshRate = 3;
            _pubCenterAdsId = new List<string>();
            _adsReady = false;

            // Due to Disallowed key in RowKey, /, \, #, ? needs to be removed
            // And excel cannot allow "=" at the beginning
            foreach (var s in _invalidRowKeyChar) {
                _deviceId = _deviceId.Replace(s, string.Empty);
                if (_deviceId.Substring(0, 1) == "=") {
                    _deviceId = "x" + _deviceId;
                }
            }

            GetAdAssemblyVersion();
            RefreshIpInfo();

            _storageCredentials = new StorageCredentials(accountName, keyValue);
            _storageAccount = new CloudStorageAccount(_storageCredentials, false);
            _tableClient = _storageAccount.CreateCloudTableClient();

            EnsureTablesCreated();
        }
開發者ID:NBitionDevelopment,項目名稱:WindowsPhonePhotoHuntAnimal,代碼行數:28,代碼來源:Tracker.cs

示例2: TestCacheStats

 public TestCacheStats(TestResultStorage testResultStorage, CloudTableClient tableClient)
 {
     _testResultStorage = testResultStorage;
     _unitTestCounterUtil = new CounterUtil<UnitTestCounterEntity>(tableClient.GetTableReference(AzureConstants.TableNames.CounterUnitTestQuery));
     _testCacheCounterUtil = new CounterUtil<TestCacheCounterEntity>(tableClient.GetTableReference(AzureConstants.TableNames.CounterTestCache));
     _testRunCounterUtil = new CounterUtil<TestRunCounterEntity>(tableClient.GetTableReference(AzureConstants.TableNames.CounterTestRun));
 }
開發者ID:jaredpar,項目名稱:jenkins,代碼行數:7,代碼來源:TestCacheStats.cs

示例3: QueryImpl

        private static RESTCommand<TableQuerySegment> QueryImpl(TableQuery query, TableContinuationToken token, CloudTableClient client, string tableName, TableRequestOptions requestOptions)
        {
            UriQueryBuilder builder = query.GenerateQueryBuilder();

            if (token != null)
            {
                token.ApplyToUriQueryBuilder(builder);
            }

            StorageUri tempUriList = NavigationHelper.AppendPathToUri(client.StorageUri, tableName);
            RESTCommand<TableQuerySegment> queryCmd = new RESTCommand<TableQuerySegment>(client.Credentials, tempUriList);
            requestOptions.ApplyToStorageCommand(queryCmd);

            queryCmd.CommandLocationMode = CommonUtility.GetListingLocationMode(token);
            queryCmd.RetrieveResponseStream = true;
            queryCmd.Handler = client.AuthenticationHandler;
            queryCmd.BuildClient = HttpClientFactory.BuildHttpClient;
            queryCmd.Builder = builder;
            queryCmd.BuildRequest = (cmd, uri, queryBuilder, cnt, serverTimeout, ctx) => TableOperationHttpRequestMessageFactory.BuildRequestForTableQuery(uri, builder, serverTimeout, cnt, ctx);
            queryCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp.StatusCode, null /* retVal */, cmd, ex);
            queryCmd.PostProcessResponse = async (cmd, resp, ctx) =>
            {
                TableQuerySegment resSeg = await TableOperationHttpResponseParsers.TableQueryPostProcess(cmd.ResponseStream, resp, ctx);
                if (resSeg.ContinuationToken != null)
                {
                    resSeg.ContinuationToken.TargetLocation = cmd.CurrentResult.TargetLocation;
                }

                return resSeg;
            };

            return queryCmd;
        }
開發者ID:BurtHarris,項目名稱:azure-storage-net,代碼行數:33,代碼來源:TableQuery.cs

示例4: CleanupTable

 private void CleanupTable(string tableName)
 {
     var account = CloudStorageAccount.DevelopmentStorageAccount;
     var cloudTableClient = new CloudTableClient(account.TableEndpoint, account.Credentials);
     var table = cloudTableClient.GetTableReference(tableName);
     table.DeleteIfExists();
 }
開發者ID:drinkbird,項目名稱:DrinkBird.Tools.AzureStorage,代碼行數:7,代碼來源:TableTests.cs

示例5: AzureTableStorageStatusTraceListener

        public AzureTableStorageStatusTraceListener(String initializeData) : base(initializeData)
        {
            string connectionString = null;
            string tableName = "status";

            if (initializeData != null)
            {
                foreach (String keyValuePair in initializeData.Split(','))
                {
                    String[] parts = keyValuePair.Split('*');
                    if (parts.Length == 2)
                    {
                        if (parts[0].Equals("tablestorage", StringComparison.InvariantCultureIgnoreCase))
                        {
                            connectionString = parts[1].Trim();
                        }
                        else if (parts[0].Equals("table", StringComparison.InvariantCultureIgnoreCase))
                        {
                            tableName = parts[1].Trim();
                        }
                    }
                }
            }

            if (String.IsNullOrWhiteSpace(connectionString))
            {
                throw new ArgumentNullException("tablestorage", "The initializeData string must specify the Azure table storage connection string in the tablestorage field.");
            }

            this._storageAccount = CloudStorageAccount.Parse(connectionString);
            this._tableClient = this._storageAccount.CreateCloudTableClient();
            this._table = this._tableClient.GetTableReference(tableName);
            this._table.CreateIfNotExists();
        }
開發者ID:jinujoseph,項目名稱:NuGet.Services.Metadata,代碼行數:34,代碼來源:AzureTableStorageStatusTraceListener.cs

示例6: Init

        private void Init()
        {
            Trace.TraceInformation("Starting initialization.");
            Account = CloudStorageAccount.Parse(ConfigurationManager.AppSettings[Constants.ConfigurationSectionKey]);
            TableClient = Account.CreateCloudTableClient();

            Container = Account.CreateCloudBlobClient().GetContainerReference(Constants.ContainerName);

            BlobContainerPermissions blobPermissions = new BlobContainerPermissions();
            blobPermissions.SharedAccessPolicies.Add(ConfigurationManager.AppSettings["AccountId"], new SharedAccessBlobPolicy()
            {
                SharedAccessExpiryTime = DateTime.UtcNow.AddHours(10),
                Permissions = SharedAccessBlobPermissions.Write |
                   SharedAccessBlobPermissions.Read
            });
            blobPermissions.PublicAccess = BlobContainerPublicAccessType.Off;

            // Set the permission policy on the container.
            Container.SetPermissions(blobPermissions);

            SasToken = Container.GetSharedAccessSignature(new SharedAccessBlobPolicy(), ConfigurationManager.AppSettings["AccountId"]);

            BlobBaseUri = Account.BlobEndpoint;
            Trace.TraceInformation("Initialization finished.");
        }
開發者ID:valeryjacobs,項目名稱:EarzyTenant,代碼行數:25,代碼來源:CruelCache.cs

示例7: TProduct

        public TProduct(string affiliate, string code, int qty, bool force_lookup = false)
        {
            ProductCode = code;
            Qty = qty;

            cloud = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("AbundaStorage"));

            client = cloud.CreateCloudTableClient();

            products = client.GetTableReference("Products");
            products.CreateIfNotExists();

            using (var context = new DataBaseDataContext())
            {
                var aff = (from ev in context.Affiliates
                           where ev.code == affiliate
                           select ev).FirstOrDefault();

                merchantID = aff.MerchantID;
                marketplaceID = aff.MarketPlaceID;
                secretKey = aff.SecretKey;
                accessKey = aff.AccessKey;
            }

            var amzResults = PerformAmazonLookup();
        }
開發者ID:WickedMonkeySoftware,項目名稱:AbundaAzure,代碼行數:26,代碼來源:TProduct.cs

示例8: HomeController

        public HomeController()
        {
            storageAccount = CloudStorageAccount.Parse(
            ConfigurationManager.AppSettings["StorageConnectionString"]);

            tableClient = storageAccount.CreateCloudTableClient();

            table = tableClient.GetTableReference("fouramigos");

            table.CreateIfNotExists();

            blobClient = storageAccount.CreateCloudBlobClient();

            container = blobClient.GetContainerReference("fouramigos");

            container.CreateIfNotExists();

            BlobContainerPermissions permissions = container.GetPermissions();
            permissions.PublicAccess = BlobContainerPublicAccessType.Container;
            container.SetPermissions(permissions);


            //lägga till nya
            //var tablemodels = new TableModel("Brutus", "Uggla") { Location = "T4", Description="Uggla i träd", Type="Foto" };
            //var tablemodels1 = new TableModel("brutus", "Örn") { Location = "T4", Description="Örn som flyger", Type = "Foto" };

            //var opreation = TableOperation.Insert(tablemodels);
            //var operation2 = TableOperation.Insert(tablemodels1);

            //table.Execute(opreation);
            //table.Execute(operation2);
        }
開發者ID:Quintoh,項目名稱:Konstprojektet,代碼行數:32,代碼來源:HomeController.cs

示例9: CloudCoreStoredTable

 protected CloudCoreStoredTable(string accountSonnectionString = "")
 {
     SetAccount(accountSonnectionString);
     cloudTableClient = cloudStorageAccount.CreateCloudTableClient();
     cloudTable = cloudTableClient.GetTableReference(GetType().Name.Replace("Entity", "").Replace("Table", "").ToLower());
     cloudTable.CreateIfNotExists();
 }
開發者ID:Exclr8,項目名稱:CloudCore,代碼行數:7,代碼來源:TableStorage.cs

示例10: NDIAzureTableController

 static NDIAzureTableController()
 {
     _storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
     _tableClient = _storageAccount.CreateCloudTableClient();
     _table = _tableClient.GetTableReference("ndiparams");
     _retrieveOperation = TableOperation.Retrieve("VidParams", "LastVideo");
 }
開發者ID:JuanKRuiz,項目名稱:Noches-de-Innovacion-Website,代碼行數:7,代碼來源:NDIAzureTableController.cs

示例11: BlobStorageManager

 public BlobStorageManager(string blobConnectionEndPointString)
 {
     this.blobConnectionEndPointString = blobConnectionEndPointString;
     CloudStorageAccount VP2ClientBlobStorageAccount = CloudStorageAccount.Parse(blobConnectionEndPointString);
     VP2CloudBlobClient = VP2ClientBlobStorageAccount.CreateCloudBlobClient();
     VP2CloudTableClient = VP2ClientBlobStorageAccount.CreateCloudTableClient();
 }
開發者ID:RmsiskaVS,項目名稱:ClientLauncherBinariesZipper,代碼行數:7,代碼來源:BlobStorageManager.cs

示例12: GetCloudTableClient

        private CloudTableClient GetCloudTableClient(string sasUrl)
        {
            int parseIndex = sasUrl.IndexOf('?');
            if (parseIndex > 0)
            {
                string tableAddress = sasUrl.Substring(0, parseIndex);

                int tableParseIndex = tableAddress.LastIndexOf('/');
                if (tableParseIndex > 0)
                {
                    tableName = tableAddress.Substring(tableParseIndex + 1);

                    string endpointAddress = tableAddress.Substring(0, tableParseIndex);
                    string sasSignature = sasUrl.Substring(parseIndex);

                    var tableClient = new CloudTableClient(new Uri(endpointAddress), new StorageCredentials(sasSignature));

                    // This is a hack for the Azure Storage SDK to make it work with version 2012 SAS urls as long as we support them.
                    // Apply hack only if the SAS url is version 2012.
                    if (sasSignature.IndexOf("sv=2012-02-12", StringComparison.OrdinalIgnoreCase) >= 0)
                    {
                        tableClient.DefaultRequestOptions.PayloadFormat = TablePayloadFormat.AtomPub;
                        var type = typeof(TableConstants);
                        var field = type.GetField("ODataProtocolVersion", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
                        field.SetValue(null, ODataVersion.V2);
                    }

                    return tableClient;
                }
            }

            return null;
        }
開發者ID:davidebbo-test,項目名稱:TestStorageSASUrl,代碼行數:33,代碼來源:Program.cs

示例13: StorageTableAccessor

 public StorageTableAccessor(CloudStorageAccount storageAccount)
 {
     CloudTableClient tableClient = new CloudTableClient(storageAccount.TableStorageUri, storageAccount.Credentials);
     this.table = tableClient.GetTableReference(messageTableName);
     this.table.CreateIfNotExists();
     ReadFirstEntry();
 }
開發者ID:theadriangreen,項目名稱:azure-sdk-for-net,代碼行數:7,代碼來源:StorageTableAccessor.cs

示例14: CreateCustomerMetadata

        static void CreateCustomerMetadata(CloudTableClient tableClient)
        {
            Console.WriteLine("Creating customers metadata...");

            CloudTable customersMetadataTable = tableClient.GetTableReference("customersmetadata");
            customersMetadataTable.CreateIfNotExists();

            var msftAddress1 = new DictionaryTableEntity();
            msftAddress1.PartitionKey = "MSFT";
            msftAddress1.RowKey = "ADDRESS-" + Guid.NewGuid().ToString("N").ToUpper();
            msftAddress1.Add("city", "Seattle");
            msftAddress1.Add("street", "111 South Jackson");

            var msftWebsite1 = new DictionaryTableEntity();
            msftWebsite1.PartitionKey = "MSFT";
            msftWebsite1.RowKey = "WEBSITE-" + Guid.NewGuid().ToString("N").ToUpper();
            msftWebsite1.Add("url", "http://www.microsoft.com");

            var msftWebsite2 = new DictionaryTableEntity();
            msftWebsite2.PartitionKey = "MSFT";
            msftWebsite2.RowKey = "WEBSITE-" + Guid.NewGuid().ToString("N").ToUpper();
            msftWebsite2.Add("url", "http://www.windowsazure.com");

            var batch = new TableBatchOperation();
            batch.Add(TableOperation.Insert(msftAddress1));
            batch.Add(TableOperation.Insert(msftWebsite1));
            batch.Add(TableOperation.Insert(msftWebsite2));
            customersMetadataTable.ExecuteBatch(batch);

            Console.WriteLine("Done. Press ENTER to read the customer metadata.");
            Console.ReadLine();
        }
開發者ID:sandrinodimattia,項目名稱:WindowsAzure-DictionaryTableEntity,代碼行數:32,代碼來源:Program.cs

示例15: GenerateCloudTableClient

 public static CloudTableClient GenerateCloudTableClient()
 {
     Uri baseAddressUri = new Uri(TestBase.TargetTenantConfig.TableServiceEndpoint);
     CloudTableClient client = new CloudTableClient(baseAddressUri, TestBase.StorageCredentials);
     client.AuthenticationScheme = DefaultAuthenticationScheme;
     return client;
 }
開發者ID:nberardi,項目名稱:azure-sdk-for-net,代碼行數:7,代碼來源:TestBase.cs


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