Question

The following code always throws exception

....
DataServiceContext ctx = account.CreateCloudTableClient().GetDataServiceContext();
var val  = (from t in ctx.CreateTable<MyClass>("TableName") 
           select new {testval = t.id}).FirstOrDefault();

If I read the entity it works fine:

var val  = (from t in ctx.CreateTable<MyClass>("TableName") 
           select t).FirstOrDefault();

Is it impossible to read just one field (or a few, I don't want to read entity) from Azure table?

Thanks in advance.


Update:

Exception data: System.Data.Services.Client.DataServiceQueryException.

Message - "An error occurred while processing this request."

Internal Exception - code :"InvalidInput", message : "One of the request inputs is not valid."

Was it helpful?

Solution

I seem to remember that the current implementation only supports getting the full entities and does not support anonymous classes.

Another option would be to fetch the complete entity and then transform it into an anonymous type. Do note that in this case you are actually pulling full entities and then transforming them, resulting in more bandwidth consumption than would actually be needed.

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