public void CreateDeleteEntity() { string storageUri = StorageUri; string accountName = StorageAccountName; string storageAccountKey = PrimaryStorageAccountKey; string tableName = "OfficeSupplies2p1"; string partitionKey = "somePartition"; string rowKey = "A1"; string rowKeyStrong = "B1"; #region Snippet:TablesSample2CreateTableWithTableClient // Construct a new <see cref="TableClient" /> using a <see cref="TableSharedKeyCredential" />. var client = new TableClient( tableName, new Uri(storageUri), new TableSharedKeyCredential(accountName, storageAccountKey)); // Create the table in the service. client.Create(); #endregion #region Snippet:TablesSample2CreateEntity // Make an entity by defining a <see cref="Dictionary"> that includes the partition and row key. var entity = new TableEntity(partitionKey, rowKey) { { "Product", "Markers" }, { "Price", 5.00 }, }; // Insert the newly created entity. client.CreateEntity(entity); #endregion #region Snippet:TablesSample2CreateStronglyTypedEntity // Make a strongly typed entity by defining a custom class that extends <see cref="TableEntity">. var strongEntity = new OfficeSupplyEntity { PartitionKey = partitionKey, RowKey = rowKeyStrong, Product = "Notebook", Price = 3.00 }; // Insert the newly created entity. client.CreateEntity(strongEntity); #endregion #region Snippet:TablesSample2DeleteEntity // Delete the entity given the partition and row key. client.DeleteEntity(partitionKey, rowKey); #endregion #region Snippet:TablesSample2DeleteTableWithTableClient client.Delete(); #endregion }
public Task DeleteTask(Guid taskId) { var entity = _client.Query <TableEntity>(t => t[nameof(Entities.Task.Id)].Equals(taskId)) .FirstOrDefault(); if (entity is null) { throw new ArgumentOutOfRangeException(nameof(taskId)); } var response = _client.DeleteEntity(entity.PartitionKey, entity.RowKey, entity.ETag); return(Task.CompletedTask); }
public void CreateDeleteEntity() { string storageUri = StorageUri; string accountName = StorageAccountName; string storageAccountKey = PrimaryStorageAccountKey; string tableName = "OfficeSupplies2p1"; string partitionKey = "Stationery"; string rowKey = "A1"; string rowKeyStrong = "B1"; #region Snippet:TablesSample2CreateTableWithTableClient // Construct a new <see cref="TableClient" /> using a <see cref="TableSharedKeyCredential" />. var tableClient = new TableClient( tableName, new Uri(storageUri), new TableSharedKeyCredential(accountName, storageAccountKey)); // Create the table in the service. tableClient.Create(); #endregion #region Snippet:TablesSample2CreateDictionaryEntity // Make a dictionary entity by defining a <see cref="TableEntity">. var entity = new TableEntity(partitionKey, rowKey) { { "Product", "Marker Set" }, { "Price", 5.00 }, { "Quantity", 21 } }; Console.WriteLine($"{entity.RowKey}: {entity["Product"]} costs ${entity.GetDouble("Price")}."); #endregion #region Snippet:TablesSample2AddEntity // Add the newly created entity. tableClient.AddEntity(entity); #endregion #region Snippet:TablesSample2CreateStronglyTypedEntity // Create an instance of the strongly-typed entity and set their properties. var strongEntity = new OfficeSupplyEntity { PartitionKey = partitionKey, RowKey = rowKeyStrong, Product = "Notebook", Price = 3.00, Quantity = 50 }; Console.WriteLine($"{entity.RowKey}: {strongEntity.Product} costs ${strongEntity.Price}."); #endregion // Add the newly created entity. tableClient.AddEntity(strongEntity); #region Snippet:TablesSample2DeleteEntity // Delete the entity given the partition and row key. tableClient.DeleteEntity(partitionKey, rowKey); #endregion #region Snippet:TablesSample2DeleteTableWithTableClient tableClient.Delete(); #endregion }
public Response Delete(string rowKey) => _tableClient.DeleteEntity(_partitionKey, rowKey);
public void Delete(string container, string PartitionKey, string RowKey) { TableClient tableClient = new TableClient(_connectionString, container); tableClient.DeleteEntity(PartitionKey, RowKey); }