In Azure Table Storage I noticed that DataServiceContext.CreateQuery<T> does not populate the ETag property. Is this expected? Are there any options other then CreateQuery<T> that I can use for ad-hoc queries?

Thanks

有帮助吗?

解决方案

If you're using version 2 and above of the storage client library you can use ExecuteQuery method on the table. Something like below:

var table = storageAccount.CreateCloudTableClient().GetTableReference(tableName);
TableQuery<MyEntity> query = new Microsoft.WindowsAzure.Storage.Table.TableQuery<MyEntity>();
var queryResults = table.ExecuteQuery<MyEntity>(query).Take(5).ToList();

queryResults will contain the list of MyEntity and they will have ETag populated.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top