I have method that submits batch transaction to table storage (Nuget: Azure.Data.Tables - 12.6.1).
Code below:

private static async Task BatchManipulateEntities<T>(TableClient tableClient, IEnumerable<T> entities, TableTransactionActionType tableTransactionActionType, int batchSize) where T : class, ITableEntity, new()
{
    var groups = entities.GroupBy(x => new { x.PartitionKey });
    foreach (var group in groups)
    {
        var items = group.AsEnumerable();
        while (items.Any())
        {
            var batch = items.Take(batchSize);
            items = items.Skip(batchSize);

            var actions = batch.Select(e => new TableTransactionAction(tableTransactionActionType, e)).ToList();
            await tableClient.SubmitTransactionAsync(actions); // <-- Will this count as one batch write operation?
        }
    }
}

这将调用最多100个TableTransactionActions的SubmitTransactionAsync. 但是,提交的批量交易是在幕后算作一个"批量写入操作",还是实际上是100个不同的操作?

Batch write operation is three times more costly than normal write operation, but if behind the scenes hundred entities will be uploaded as one batch write operation than I'm a happy man ;)
Azure Table Storage Pricing

如果有更聪明的人能澄清这一点,我将不胜感激!

推荐答案

你可以从文档页面上阅读更多关于它的信息.https://docs.microsoft.com/en-us/rest/api/storageservices/performing-entity-group-transactions

从文档中:

更改集中的操作是自动处理的;也就是说,更改集中的所有操作要么成功,要么失败.操作按照在更改集中指定的顺序进行处理.

因为一次只能更新一个分区,我假设他们会做一些事情,使其少于100个不同的操作,但他们没有指定它是如何在后端实现的.重要的是,您可以将其视为一个操作,并且知道所有操作要么成功,要么失败;您不会得到部分应用的事务.

Csharp相关问答推荐

在ASP.NET中为数据注释 Select 合适的语言

如何在Reflection. Emit中使用具有运行时定义的类型参数的泛型类型

TDLib与机器人共享电话号码

C#中使用BouncyCastle计算CMac

返回TyedResults.BadRequest<;字符串>;时问题详细信息不起作用

应用程序启动器,可 Select 物理屏幕

Appsettings.json未加载.Net 8 Blaazor Web程序集

静态对象构造顺序

如何在毛伊岛应用程序中完美地同步视图模型和视图的加载?

将字节转换为 struct 并返回

如何将端点(或с匹配请求并判断其路径)添加到BCL?

委托RequestDelegate不带2个参数-ASP.NET Core 8最小API

为值对象编写自定义JsonConverter

C#Microsoft.CodeAnalysis.CSharp.Scriiting不等待并行.对于

如何在C#.NET桌面应用程序中动态更改焦点工具上的后退 colored颜色

在C#/ASP.NET Core 7中,什么可能导致POST请求作为GET请求发送

如何在特定时间间隔运行多个后台任务?

在Unity C#中按键点击错误的参数

为什么C#中的类型别名不能在另一个别名中使用?

C#LINQ多行条件