public async Task InsertOrReplace_CleanTableDuplicateRowsInRequest_ContinuesAnyway() { TableRow[] rows = new[] { new TableRow("pk", "rk"), new TableRow("pk", "rk"), new TableRow("pk", "rk1") }; StorageException ex = await Assert.ThrowsAsync <StorageException>(() => _tables.InsertOrReplaceAsync(_tableName, rows)); Assert.Equal(ErrorCode.DuplicateKey, ex.ErrorCode); IEnumerable <TableRow> rows2 = await _tables.GetAsync(_tableName, "pk"); Assert.Empty(rows2); }
public void Write(string key, string value) { var rowId = new TableRowId(_partitionKey, key); if (value == null) { _tableStorage.DeleteAsync(_tableName, new[] { rowId }).Wait(); } else { var row = new TableRow(rowId); row["value"] = value; _tableStorage.InsertOrReplaceAsync(_tableName, new[] { row }).Wait(); } }