0

I need to be able to retrieve the etag from an Azure query, and attach them to my entities. The service will be updating the entities on a separate thread, so I need to store the etag of when the entity was received so that it can be attached to the DataServiceContext on the other thread.

So far, the only method I have found is doing this on the querying DataServiceContext:

context.Entities.Single(entityDescriptor =>
                        entityDescriptor.Entity == entity).ETag;

I am looking for a way that could be retreived when the entity is being serialized, or something that could be more streamlined, rather than having to search through the DataServiceContext on every iteration and adding it manually.

4

2 回答 2

0

有一种不那么冗长的方式,在此处指定

    DataServiceContext.GetEntityDescriptor(entity).ETag.
于 2012-10-22T02:45:12.523 回答
0

您无需指定 eTag 即可将实体附加到服务。

您可以将 eTag 值设置为"*",以便在更新操作中盲目地覆盖实体。

于 2016-04-10T22:57:13.297 回答