Azure表中的一个事务是什么?

时间:2012-08-02 11:34:52

标签: azure-table-storage

我正试图弄清楚Azure云存储服务的成本。它说每100 000交易只需0.01美元。这个事务用于读写我猜。但是在使用LINQ进行查询时。例如,如果我要更新在100个实体中找到的值。假设我可以进行批量更新,这会调用一个事务吗?

例如,使用以下代码,它会算作一个事务吗?

CloudTableQuery<Data> aBatch = (from e in s_context.CreateQuery<Data>("Table") where e.PartitionKey == "some_pkey" select e).AsTableServiceQuery<Data>();
foreach (Data d in aBatch)
{
   d.Content = "updated content";
   s_context.UpdateObject(d);
}
s_context.SaveChangesWithRetries(SaveChangesOptions.Batch);

1 个答案:

答案 0 :(得分:0)

该代码看起来不对...您需要UpdateObject调用才能进入循环。

但是要回答一般问题,一次批量更新就是一次交易。有关详细说明,请参阅http://blogs.msdn.com/b/windowsazurestorage/archive/2010/07/09/understanding-windows-azure-storage-billing-bandwidth-transactions-and-capacity.aspx