当前位置: 首页>>代码示例>>C#>>正文


C# Table.TableRequestOptions类代码示例

本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Table.TableRequestOptions的典型用法代码示例。如果您正苦于以下问题:C# TableRequestOptions类的具体用法?C# TableRequestOptions怎么用?C# TableRequestOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TableRequestOptions类属于Microsoft.WindowsAzure.Storage.Table命名空间,在下文中一共展示了TableRequestOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: Index

        // GET: /Subscribe/

        public async Task<ActionResult> Index(string id, string listName)
        {
            // We get to this method when they click on the Confirm link in the
            // email that's sent to them after the subscribe service method is called.
            TableRequestOptions reqOptions = new TableRequestOptions()
            {
                MaximumExecutionTime = TimeSpan.FromSeconds(1.5),
                RetryPolicy = new LinearRetry(TimeSpan.FromSeconds(3), 3)
            };
            string filter = TableQuery.CombineFilters(
                TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, listName),
                TableOperators.And,
                TableQuery.GenerateFilterCondition("SubscriberGUID", QueryComparisons.Equal, id));
            var query = new TableQuery<Subscriber>().Where(filter);
            TableContinuationToken token = null;
            OperationContext ctx = new OperationContext() { ClientRequestID = "" };
            TableQuerySegment<Subscriber> currentSegment = null;
            currentSegment = await mailingListTable.ExecuteQuerySegmentedAsync(query, token, reqOptions, ctx);
            var subscriber = currentSegment.Results.ToList().Single();

            //subscriberTableRow.Status = "Verified";
            subscriber.Verified = true;
            var replaceOperation = TableOperation.Merge(subscriber);
            mailingListTable.Execute(replaceOperation);

            var newSubscriber = new SubscribeVM();
            newSubscriber.EmailAddress = subscriber.EmailAddress;
            var mailingList = await FindRowAsync(subscriber.ListName, "mailinglist");
            newSubscriber.ListDescription = mailingList.Description;
            return View(newSubscriber);
        }
开发者ID:Jinwenxin,项目名称:ApplicationInsights-Home,代码行数:33,代码来源:SubscribeController.cs

示例3: Index

        //
        // GET: /Subscription/
        //
        // Note: This way of handling may not scale and may need to use continuation tokens later
        //
        public ActionResult Index()
        {
            TableRequestOptions reqOptions = new TableRequestOptions()
            {
                MaximumExecutionTime = TimeSpan.FromSeconds(10),
                RetryPolicy = new LinearRetry(TimeSpan.FromSeconds(3), 3)
            };

            List<Subscription> subscribers;
            try
            {
                var query = new TableQuery<Subscription>().Select(new string[] {
                    "PartitionKey",
                    "RowKey",
                    "Description",
                    "Verified"
                });

                subscribers = subscribersTable.ExecuteQuery(query, reqOptions).ToList();
            }
            catch (StorageException se)
            {
                ViewBag.errorMessage = "Timeout error, try again.";
                Trace.TraceError(se.Message);
                return View("Error: " + se.Message);
            }

            return View(subscribers);
        }
开发者ID:bwrichte,项目名称:LoggingService,代码行数:34,代码来源:SubscriptionController.cs

示例4: GetAllCatalogJob

        public List<ICatalogJob> GetAllCatalogJob(string organization)
        {
            string tableName = NameHelper.GetCatalogJobTableName(organization);
            tableName = TableDataAccess.ValidateTableName(tableName);
            TableDataAccess tableDataAccess = new TableDataAccess(TableClient);
            CloudTable table = tableDataAccess.GetTable(tableName);
            if (table == null)
                return null;

            TableQuery<CatalogEntity> query = new TableQuery<CatalogEntity>().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, organization));

            query.TakeCount = 100;
            TableRequestOptions a = new TableRequestOptions();
            OperationContext c = new OperationContext();

            var queryResult = table.ExecuteQuery(query);

            List<ICatalogJob> result = new List<ICatalogJob>(queryResult.Count());
            foreach (CatalogEntity entity in queryResult)
            {
                CatalogEntity.SetOtherByPartitionRowKeys(entity);
                result.Add(entity);
            }
            return result;
        }
开发者ID:haiyangIt,项目名称:Haiyang,代码行数:25,代码来源:QueryDataAccess.cs

示例5: Apps

        public HttpResponseMessage Apps()
        {
            TableRequestOptions reqOptions = new TableRequestOptions()
            {
                MaximumExecutionTime = TimeSpan.FromSeconds(1.5),
                RetryPolicy = new LinearRetry(TimeSpan.FromSeconds(3), 3)
            };

            try
            {
                var query = new TableQuery<Subscription>().Select(new string[] { "PartitionKey" });

                List<Subscription> subscribers =
                    subscribersTable.ExecuteQuery(query, reqOptions).ToList();
                IEnumerable<string> apps =
                    subscribers.Select(s => s.ApplicationName).Distinct();
                return Request.CreateResponse(
                    HttpStatusCode.OK,
                    new
                    {
                        Success = true,
                        Apps = apps
                    },
                    Configuration.Formatters.JsonFormatter
                    );
            }
            catch (StorageException)
            {
                throw new HttpResponseException(Request.CreateErrorResponse(
                    HttpStatusCode.ServiceUnavailable,
                    "Timeout error, try again."
                    ));
            }
        }
开发者ID:bwrichte,项目名称:LoggingService,代码行数:34,代码来源:SubscriptionsController.cs

示例6: ListTables

        public IEnumerable<CloudTable> ListTables(string prefix, TableRequestOptions requestOptions = null, OperationContext operationContext = null)
        {
            requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, this);
            operationContext = operationContext ?? new OperationContext();

            return this.GenerateListTablesQuery(prefix, null).Execute(this, TableConstants.TableServiceTablesName, requestOptions, operationContext).Select(
                     tbl => new CloudTable(NavigationHelper.AppendPathToUri(this.BaseUri, tbl[TableConstants.TableName].StringValue), this));
        }
开发者ID:nagyist,项目名称:azure-sdk-for-net,代码行数:8,代码来源:CloudTableClient.cs

示例7: Execute

        internal TableResult Execute(CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext)
        {
            TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client);
            operationContext = operationContext ?? new OperationContext();
            CommonUtility.AssertNotNullOrEmpty("tableName", table.Name);

            return Executor.ExecuteSync(this.GenerateCMDForOperation(client, table, modifiedOptions), modifiedOptions.RetryPolicy, operationContext);
        }
开发者ID:renlesterdg,项目名称:azure-storage-net,代码行数:8,代码来源:TableOperation.cs

示例8: TableRequestOptions

 /// <summary>
 /// Initializes a new instance of the <see cref="TableRequestOptions"/> class with the specified <see cref="TableRequestOptions"/>.
 /// </summary>
 /// <param name="other">The request options used to initialize this instance of the <see cref="TableRequestOptions"/> class.</param>
 public TableRequestOptions(TableRequestOptions other)
 {
     if (other != null)
     {
         this.ServerTimeout = other.ServerTimeout;
         this.RetryPolicy = other.RetryPolicy;
         this.MaximumExecutionTime = other.MaximumExecutionTime;
     }
 }
开发者ID:Juliako,项目名称:azure-sdk-for-net,代码行数:13,代码来源:TableRequestOptions.cs

示例9: Main

        static void Main(string[] args)
        {
            var accountName = args[0];
            var accountKey = args[1];
            var GifsDir = args[2];

            storageAccount =  CloudStorageAccount.Parse(String.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}",accountName,accountKey));
            
            // Create the blob client.
            CloudBlobClient blobClient = new CloudBlobClient (storageAccount.BlobEndpoint, storageAccount.Credentials);

            // Create blob container if it doesn't exist.
            CloudBlobContainer blobContainer = blobClient.GetContainerReference("memes");
            blobContainer.CreateIfNotExists(BlobContainerPublicAccessType.Container);

            // Create the table client.
            CloudTableClient tableClient = new Microsoft.WindowsAzure.Storage.Table.CloudTableClient(storageAccount.TableEndpoint, storageAccount.Credentials);

            // Create the table if it doesn't exist.
            CloudTable table = tableClient.GetTableReference("MemeMetadata");
            var statusTable = table.CreateIfNotExists();

            var list = new List<ClipMemeEntity> {
                new ClipMemeEntity { BlobUri = "https://clipmeme2014.blob.core.windows.net/memes/20140401-200312-horse-cannon.gif", BlobName = "20140401-200312-horse-cannon.gif", Description = "Deploy", Username = "Mads"  },
                new ClipMemeEntity { BlobUri = "https://clipmeme2014.blob.core.windows.net/memes/20140401-200344-updated-visual-studio-theme.gif", BlobName = "20140401-200344-updated-visual-studio-theme.gif", Description = "News vs Theme", Username = "Mads"  },
                new ClipMemeEntity { BlobUri = "https://clipmeme2014.blob.core.windows.net/memes/20140401-200447-oops.gif", BlobName = "20140401-200447-oops.gif", Description = "First Iteration", Username = "Mads"  },
                new ClipMemeEntity { BlobUri = "https://clipmeme2014.blob.core.windows.net/memes/20140401-200534-just-learned-about-git-rebase.gif", BlobName = "20140401-200534-just-learned-about-git-rebase.gif", Description = "Tests Pass on First Try", Username = "Mads"  },
                new ClipMemeEntity { BlobUri = "https://clipmeme2014.blob.core.windows.net/memes/20140401-200606-when-i-unstash-something.gif", BlobName = "20140401-200606-when-i-unstash-something.gif", Description = "Scale up", Username = "Mads"  },
                new ClipMemeEntity { BlobUri = "https://clipmeme2014.blob.core.windows.net/memes/20140401-200750-dog-race.gif", BlobName = "20140401-200750-dog-race.gif", Description = "Sprint", Username = "Mads"  },
                new ClipMemeEntity { BlobUri = "https://clipmeme2014.blob.core.windows.net/memes/20140401-200800-cookies.gif", BlobName = "20140401-200800-cookies.gif", Description = "Scottgu Promoted", Username = "Mads"  },
                new ClipMemeEntity { BlobUri = "https://clipmeme2014.blob.core.windows.net/memes/20140401-200849-when-i-merge-my-own-pull-requests.gif", BlobName = "20140401-200849-when-i-merge-my-own-pull-requests.gif", Description = "to the cloud", Username = "Mads"  },
                new ClipMemeEntity { BlobUri = "https://clipmeme2014.blob.core.windows.net/memes/20140401-200924-disco-girl.gif", BlobName = "20140401-200924-disco-girl.gif", Description = "Hanseldance", Username = "Mads"  },
                new ClipMemeEntity { BlobUri = "https://clipmeme2014.blob.core.windows.net/memes/20140401-201030-when-someone-merges-your-pull-request-before-its-ready.gif", BlobName = "20140401-201030-when-someone-merges-your-pull-request-before-its-ready.gif", Description = "accidental git push", Username = "Mads"  },
                new ClipMemeEntity { BlobUri = "https://clipmeme2014.blob.core.windows.net/memes/20140401-201102-Fat-Dance-Suit-Men-Rave-On-At-Home.gif", BlobName = "20140401-201102-Fat-Dance-Suit-Men-Rave-On-At-Home.gif", Description = "msft at $40", Username = "Mads"  }                
            };

            foreach (var item in list)
	        {
                // Retrieve reference to a blob
                CloudBlockBlob blockBlob = blobContainer.GetBlockBlobReference(item.BlobName);

                using (var fileStream = System.IO.File.OpenRead(String.Format("{0}\\{1}",GifsDir,item.BlobName)))
                {
                    blockBlob.UploadFromStream(fileStream);
                } 

                var requestOptions = new Microsoft.WindowsAzure.Storage.Table.TableRequestOptions()
                {
                    RetryPolicy = new Microsoft.WindowsAzure.Storage.RetryPolicies.LinearRetry(TimeSpan.FromMilliseconds(500), 5)
                };

                table.Execute(Microsoft.WindowsAzure.Storage.Table.TableOperation.Insert(item), requestOptions);
	        }

            return;
        }
开发者ID:kirpasingh,项目名称:MicrosoftAzureTrainingKit,代码行数:56,代码来源:Program.cs

示例10: ExecuteQuerySegmented

        internal TableQuerySegment<DynamicTableEntity> ExecuteQuerySegmented(TableContinuationToken token, CloudTableClient client, string tableName, TableRequestOptions requestOptions, OperationContext operationContext)
        {
            CommonUtils.AssertNotNullOrEmpty("tableName", tableName);
            TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client);
            operationContext = operationContext ?? new OperationContext();

            RESTCommand<TableQuerySegment<DynamicTableEntity>> cmdToExecute = QueryImpl(this, token, client, tableName, modifiedOptions);

            return Executor.ExecuteSync(cmdToExecute, modifiedOptions.RetryPolicy, operationContext);
        }
开发者ID:Jasontang501,项目名称:azure-sdk-for-net,代码行数:10,代码来源:TableQueryNonGeneric.cs

示例11: RetrivesTables

 internal List<MailingList> RetrivesTables(string rowKey)
 {
     TableRequestOptions reqOptions = new TableRequestOptions()
     {
         MaximumExecutionTime = TimeSpan.FromSeconds(1.5),
         RetryPolicy = new LinearRetry(TimeSpan.FromSeconds(3), 3)
     };
     var query = new TableQuery<MailingList>().Where(TableQuery.GenerateFilterCondition(rowKey, QueryComparisons.Equal, ConfigurationManager.AppSettings["TableMailinglist"]));            
    return mailingListTable.ExecuteQuery(query, reqOptions).ToList();
 }
开发者ID:prashanthganathe,项目名称:PersonalProjects,代码行数:10,代码来源:TableHelper.cs

示例12: Delete

 /// <summary>
 /// Delete the specified azure storage table
 /// </summary>
 /// <param name="table">Cloud table object</param>
 /// <param name="requestOptions">Table request options</param>
 /// <param name="operationContext">Operation context</param>
 public void Delete(CloudTable table, TableRequestOptions requestOptions = null, OperationContext operationContext = null)
 {
     foreach (CloudTable tableRef in tableList)
     {
         if (table.Name == tableRef.Name)
         {
             tableList.Remove(tableRef);
             return;
         }
     }
 }
开发者ID:xmbms,项目名称:azure-sdk-tools,代码行数:17,代码来源:MockStorageTableManagement.cs

示例13: GetTableReferenceFromServer

 /// <summary>
 /// Get table reference from azure server
 /// </summary>
 /// <param name="name">Table name</param>
 /// <param name="requestOptions">Table request options</param>
 /// <param name="operationContext">Operation context</param>
 /// <returns>A CloudTable object if the specified table exists, otherwise null.</returns>
 public CloudTable GetTableReferenceFromServer(string name, TableRequestOptions requestOptions, OperationContext operationContext)
 {
     foreach (CloudTable table in tableList)
     {
         if (table.Name == name)
         {
             return table;
         }
     }
     return null;
 }
开发者ID:AzureRT,项目名称:azure-sdk-tools,代码行数:18,代码来源:MockStorageTableManagement.cs

示例14: Main

        static void Main(string[] args)
        {
            Console.WriteLine("Table encryption sample");

            // Retrieve storage account information from connection string
            // How to create a storage connection string - https://azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string/
            CloudStorageAccount storageAccount = EncryptionShared.Utility.CreateStorageAccountFromConnectionString();
            CloudTableClient client = storageAccount.CreateCloudTableClient();
            CloudTable table = client.GetTableReference(DemoTable + Guid.NewGuid().ToString("N"));

            try
            {
                table.Create();

                // Create the IKey used for encryption.
                RsaKey key = new RsaKey("private:key1");

                EncryptedEntity ent = new EncryptedEntity() { PartitionKey = Guid.NewGuid().ToString(), RowKey = DateTime.Now.Ticks.ToString() };
                ent.Populate();

                TableRequestOptions insertOptions = new TableRequestOptions()
                {
                    EncryptionPolicy = new TableEncryptionPolicy(key, null)
                };

                // Insert Entity
                Console.WriteLine("Inserting the encrypted entity.");
                table.Execute(TableOperation.Insert(ent), insertOptions, null);

                // For retrieves, a resolver can be set up that will help pick the key based on the key id.
                LocalResolver resolver = new LocalResolver();
                resolver.Add(key);

                TableRequestOptions retrieveOptions = new TableRequestOptions()
                {
                    EncryptionPolicy = new TableEncryptionPolicy(null, resolver)
                };

                // Retrieve Entity
                Console.WriteLine("Retrieving the encrypted entity.");
                TableOperation operation = TableOperation.Retrieve(ent.PartitionKey, ent.RowKey);
                TableResult result = table.Execute(operation, retrieveOptions, null);

                Console.WriteLine("Press enter key to exit");
                Console.ReadLine();
            }
            finally
            {
                table.DeleteIfExists();
            }
        }
开发者ID:Gajendra-Bahakar,项目名称:azure-storage-net,代码行数:51,代码来源:Program.cs

示例15: ApplyDefaults

 internal static TableRequestOptions ApplyDefaults(TableRequestOptions requestOptions, CloudTableClient client)
 {
     requestOptions = new TableRequestOptions(requestOptions);
     requestOptions.RetryPolicy = requestOptions.RetryPolicy == null
                                      ? client.RetryPolicy
                                      : requestOptions.RetryPolicy;
     requestOptions.ServerTimeout = requestOptions.ServerTimeout == null
                                           ? client.ServerTimeout
                                           : requestOptions.ServerTimeout;
     requestOptions.MaximumExecutionTime = requestOptions.MaximumExecutionTime == null
                                               ? client.MaximumExecutionTime
                                               : requestOptions.MaximumExecutionTime;
     return requestOptions;
 }
开发者ID:Juliako,项目名称:azure-sdk-for-net,代码行数:14,代码来源:TableRequestOptions.cs


注:本文中的Microsoft.WindowsAzure.Storage.Table.TableRequestOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。