internal Task <TableResult> ExecuteAsync(CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken) { TableRequestOptions requestOptions2 = TableRequestOptions.ApplyDefaults(requestOptions, client); operationContext = (operationContext ?? new OperationContext()); CommonUtility.AssertNotNullOrEmpty("tableName", table.Name); return(client.Executor.ExecuteTableOperationAsync <TableResult>(this, client, table, requestOptions2, operationContext, cancellationToken)); }
internal TableQuerySegment <TResult> ExecuteQuerySegmented <TResult>(TableContinuationToken token, CloudTableClient client, CloudTable table, EntityResolver <TResult> resolver, TableRequestOptions requestOptions, OperationContext operationContext) { CommonUtility.AssertNotNullOrEmpty("tableName", table.Name); CommonUtility.AssertNotNull("resolver", resolver); TableRequestOptions requestOptions2 = TableRequestOptions.ApplyDefaults(requestOptions, client); operationContext = (operationContext ?? new OperationContext()); return(client.Executor.ExecuteQuerySegmented(this, token, client, table, resolver, requestOptions2, operationContext)); }
public virtual IEnumerable <CloudTable> ListTables(string prefix = null, TableRequestOptions requestOptions = null, OperationContext operationContext = null) { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, this); operationContext = (operationContext ?? new OperationContext()); CloudTable tableReference = GetTableReference("Tables"); return(from tbl in GenerateListTablesQuery(prefix, null).ExecuteInternal(this, tableReference, requestOptions, operationContext) select new CloudTable(tbl["TableName"].StringValue, this)); }
public virtual TableResultSegment ListTablesSegmented(string prefix, int?maxResults, TableContinuationToken currentToken, TableRequestOptions requestOptions = null, OperationContext operationContext = null) { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, this); operationContext = (operationContext ?? new OperationContext()); CloudTable tableReference = GetTableReference("Tables"); TableQuerySegment <DynamicTableEntity> tableQuerySegment = GenerateListTablesQuery(prefix, maxResults).ExecuteQuerySegmentedInternal(currentToken, this, tableReference, requestOptions, operationContext); return(new TableResultSegment((from tbl in tableQuerySegment.Results select new CloudTable(tbl.Properties["TableName"].StringValue, this)).ToList()) { ContinuationToken = tableQuerySegment.ContinuationToken }); }
internal IEnumerable <TResult> Execute <TResult>(CloudTableClient client, CloudTable table, EntityResolver <TResult> resolver, TableRequestOptions requestOptions, OperationContext operationContext) { CommonUtility.AssertNotNullOrEmpty("tableName", table.Name); TableRequestOptions modifiedOptions = TableRequestOptions.ApplyDefaults(requestOptions, client); operationContext = (operationContext ?? new OperationContext()); return(CommonUtility.LazyEnumerable(delegate(TableContinuationToken continuationToken) { TableQuerySegment <TResult> tableQuerySegment = ExecuteQuerySegmented(continuationToken, client, table, resolver, modifiedOptions, operationContext); return new ResultSegment <TResult>(tableQuerySegment.Results) { ContinuationToken = tableQuerySegment.ContinuationToken }; }, takeCount.HasValue ? takeCount.Value : long.MaxValue)); }
public virtual Task CreateAsync(TableRequestOptions requestOptions, OperationContext operationContext, string serializedIndexingPolicy, int?throughput, CancellationToken cancellationToken) { ServiceClient.AssertPremiumFeaturesOnlyToCosmosTables(throughput, serializedIndexingPolicy); requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, ServiceClient); operationContext = (operationContext ?? new OperationContext()); DynamicTableEntity dynamicTableEntity = new DynamicTableEntity(); dynamicTableEntity.SetCosmosTableName(Name); dynamicTableEntity.SetCosmosTableThroughput(throughput); dynamicTableEntity.SetCosmosTableIndexingPolicy(serializedIndexingPolicy); return(new TableOperation(dynamicTableEntity, TableOperationType.Insert, echoContent: false) { IsTableEntity = true }.ExecuteAsync(table: ServiceClient.GetTableReference("Tables"), client: ServiceClient, requestOptions: requestOptions, operationContext: operationContext, cancellationToken: cancellationToken)); }
internal Task <TableBatchResult> ExecuteAsync(CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken) { TableRequestOptions requestOptions2 = TableRequestOptions.ApplyDefaults(requestOptions, client); operationContext = (operationContext ?? new OperationContext()); CommonUtility.AssertNotNullOrEmpty("tableName", table.Name); if (operations.Count == 0) { throw new InvalidOperationException("Cannot execute an empty batch operation"); } if (operations.Count > 100) { throw new InvalidOperationException("The maximum number of operations allowed in one batch has been exceeded."); } return(client.Executor.ExecuteTableBatchOperationAsync <TableBatchResult>(this, client, table, requestOptions2, operationContext, cancellationToken)); }
public virtual void Delete(TableRequestOptions requestOptions = null, OperationContext operationContext = null) { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, ServiceClient); operationContext = (operationContext ?? new OperationContext()); new TableOperation(new DynamicTableEntity { Properties = { { "TableName", new EntityProperty(Name) } } }, TableOperationType.Delete) { IsTableEntity = true }.Execute(table: ServiceClient.GetTableReference("Tables"), client: ServiceClient, requestOptions: requestOptions, operationContext: operationContext); }
public virtual Task DeleteAsync(TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken) { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, ServiceClient); operationContext = (operationContext ?? new OperationContext()); return(new TableOperation(new DynamicTableEntity { Properties = { { "TableName", new EntityProperty(Name) } } }, TableOperationType.Delete) { IsTableEntity = true }.ExecuteAsync(table: ServiceClient.GetTableReference("Tables"), client: ServiceClient, requestOptions: requestOptions, operationContext: operationContext, cancellationToken: cancellationToken)); }
public virtual async Task <bool> ExistsAsync(TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken) { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, ServiceClient); operationContext = (operationContext ?? new OperationContext()); return((await new TableOperation(new DynamicTableEntity { Properties = { { "TableName", new EntityProperty(Name) } } }, TableOperationType.Retrieve) { IsTableEntity = true }.ExecuteAsync(table: ServiceClient.GetTableReference("Tables"), client: ServiceClient, requestOptions: requestOptions, operationContext: operationContext, cancellationToken: cancellationToken)).HttpStatusCode == 200); }
public bool Exists(TableRequestOptions requestOptions = null, OperationContext operationContext = null) { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, ServiceClient); operationContext = (operationContext ?? new OperationContext()); return(new TableOperation(new DynamicTableEntity { Properties = { { "TableName", new EntityProperty(Name) } } }, TableOperationType.Retrieve) { IsTableEntity = true }.Execute(table: ServiceClient.GetTableReference("Tables"), client: ServiceClient, requestOptions: requestOptions, operationContext: operationContext).HttpStatusCode == 200); }
public virtual async Task <bool> DeleteIfExistsAsync(TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken) { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, ServiceClient); operationContext = (operationContext ?? new OperationContext()); try { if (!(await ExistsAsync(requestOptions, operationContext, cancellationToken))) { return(false); } } catch (StorageException ex) { if (ex.RequestInformation != null && ex.RequestInformation.HttpStatusCode != 403) { throw; } } catch (Exception) { throw; } cancellationToken.ThrowIfCancellationRequested(); try { await DeleteAsync(requestOptions, operationContext, cancellationToken); return(true); } catch (StorageException ex3) { if (ex3.RequestInformation.HttpStatusCode == 404 && (ex3.RequestInformation.ExtendedErrorInformation == null || ex3.RequestInformation.ExtendedErrorInformation.ErrorCode == StorageErrorCodeStrings.ResourceNotFound)) { return(false); } throw; } catch (Exception) { throw; } }
public virtual bool DeleteIfExists(TableRequestOptions requestOptions = null, OperationContext operationContext = null) { TableRequestOptions requestOptions2 = TableRequestOptions.ApplyDefaults(requestOptions, ServiceClient); operationContext = (operationContext ?? new OperationContext()); try { if (!Exists(requestOptions2, operationContext)) { return(false); } } catch (StorageException ex) { if (ex.RequestInformation.HttpStatusCode != 403) { throw; } } try { Delete(requestOptions2, operationContext); return(true); } catch (StorageException ex2) { if (ex2.RequestInformation.HttpStatusCode != 404) { throw; } if (ex2.RequestInformation.ExtendedErrorInformation != null && !(ex2.RequestInformation.ExtendedErrorInformation.ErrorCode == StorageErrorCodeStrings.ResourceNotFound)) { throw; } return(false); } }
public virtual async Task <TableResultSegment> ListTablesSegmentedAsync(string prefix, int?maxResults, TableContinuationToken currentToken, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken) { try { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, this); operationContext = (operationContext ?? new OperationContext()); CloudTable tableReference = GetTableReference("Tables"); TableQuerySegment <DynamicTableEntity> tableQuerySegment = await GenerateListTablesQuery(prefix, maxResults).ExecuteQuerySegmentedInternalAsync(currentToken, this, tableReference, requestOptions, operationContext, cancellationToken); return(new TableResultSegment((from tbl in tableQuerySegment.Results select new CloudTable(tbl.Properties["TableName"].StringValue, this)).ToList()) { ContinuationToken = tableQuerySegment.ContinuationToken }); } catch (StorageException ex) { if (ex != null && ex.RequestInformation?.HttpStatusCode == 404) { return(new TableResultSegment(new List <CloudTable>())); } throw; } }
public virtual async Task <bool> CreateIfNotExistsAsync(TableRequestOptions requestOptions, OperationContext operationContext, string serializedIndexingPolicy, int?throughput, CancellationToken cancellationToken) { TableRequestOptions requestOptions2 = TableRequestOptions.ApplyDefaults(requestOptions, ServiceClient); operationContext = (operationContext ?? new OperationContext()); try { await CreateAsync(requestOptions2, operationContext, serializedIndexingPolicy, throughput, cancellationToken); return(true); } catch (StorageException ex) { if (ex.RequestInformation.HttpStatusCode == 409 && (ex.RequestInformation.ExtendedErrorInformation == null || ex.RequestInformation.ExtendedErrorInformation.ErrorCode == TableErrorCodeStrings.TableAlreadyExists)) { return(false); } throw; } catch (Exception) { throw; } }
public virtual Task <ServiceStats> GetServiceStatsAsync(TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken) { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, this); operationContext = (operationContext ?? new OperationContext()); return(Executor.GetServiceStatsAsync(this, requestOptions, operationContext, cancellationToken)); }
public virtual ServiceStats GetServiceStats(TableRequestOptions requestOptions = null, OperationContext operationContext = null) { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, this); operationContext = (operationContext ?? new OperationContext()); return(Executor.GetServiceStats(this, requestOptions, operationContext)); }
public virtual Task SetServicePropertiesAsync(ServiceProperties properties, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken) { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, this); operationContext = (operationContext ?? new OperationContext()); return(Executor.SetServicePropertiesOperationAsync(properties, this, requestOptions, operationContext, cancellationToken)); }
public virtual void SetServiceProperties(ServiceProperties properties, TableRequestOptions requestOptions = null, OperationContext operationContext = null) { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, this); operationContext = (operationContext ?? new OperationContext()); Executor.SetServicePropertiesOperation(properties, this, requestOptions, operationContext); }
public virtual Task SetPermissionsAsync(TablePermissions permissions, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken) { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, ServiceClient); operationContext = (operationContext ?? new OperationContext()); return(ServiceClient.Executor.SetTablePermissionsAsync(permissions, ServiceClient, this, requestOptions, operationContext, cancellationToken)); }
public virtual void SetPermissions(TablePermissions permissions, TableRequestOptions requestOptions = null, OperationContext operationContext = null) { requestOptions = TableRequestOptions.ApplyDefaults(requestOptions, ServiceClient); operationContext = (operationContext ?? new OperationContext()); ServiceClient.Executor.SetTablePermissions(permissions, ServiceClient, this, requestOptions, operationContext); }