Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top