azure - 无法在 CreateQuery 上获取 Azure TableEntity etag

标签 azure azure-table-storage

我正在查询表中的实体,更改它们,然后执行替换操作。 替换操作失败,因为 etag 上的 etag 属性为 null。我检查过,当我从 CreateQuery() 调用获取实体时,etag 为空,但在我执行 Retrieve() 时填充。有没有办法手动获取etag?

IEnumerable<MyEntity> query = from e in serviceContext.CreateQuery<MyEntity>(tableName)
                                        where e.Id == queryId
                                        select e;

MyEntity entity = query.FirstOrDefault();

// Update the MyEntity object

var replaceOperation = TableOperation.Replace(entity);
MyCloudTableClient.GetTableReference(tableName).Execute(replaceOperation);

// Exception is thrown here that eTag value is null

最佳答案

您是否尝试过使用 TableQuery 而不是 DataServiceQuery?

所以..

cloudTableClient.GetTableReference(TableName).CreateQuery() 而不是 serviceContext.CreateQuery...‏

顺便说一句,我认为 TableQuery 是 2.1 中的新功能...

关于azure - 无法在 CreateQuery 上获取 Azure TableEntity etag,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16073375/

相关文章:

azure - 获取每个用户的工作项字段的总统计信息

azure-storage - 按行键作为条件查询 Azure 表

azure - 尝试使用适用于 Azure 的 Ansible 动态 list 插件时出错

Azure 应用服务计划属于 Linux 类型,但显示操作系统为 Windows

c# - 用于排序或筛选表实体的 Azure 定价

azure - 将对象更新到 Azure 表存储 - 有没有办法获取新的时间戳?

azure - TableQuery.CombineFilters 中 FilterCondition 的最大数量

r - 尝试使用 R 连接到 Azure 表时出现 HTTP/1.1 400 错误

azure - 如何在 "NO RESULTS FOUND"时将 Azure Application Insights Analytics 查询固定到仪表板

azure - 宇宙数据库 : SQL API + Graph API -- Really multi-model?