How to use CloudFX to query Azure Table storage

92 Views Asked by At

We have spent some time now researching through the google to understand how to query our Azure table (on the storage emulator setting) using the cloudFX library, but there is almost no example available that shows how this works.

here is a simple function we have written

public T GetTableRecord<T>(string tableName, string partitionKey, string rowKey) where T : TableEntity
{
   using (var tableStorage = Extensions.Find<ICloudStorageProviderExtension>().DefaultTableStorage)
   {
      var qry = tableStorage.Get<T>(tableName, partitionKey, rowKey);
      var result = qry.????
   }
}

no matter what we try with the qry.??? it always throws an exception that it cannot cast to IQueryable(T)

can someone help us with to understand how we can use this method.

Edit1:

To clarify the error, I get something like this:

var entity = tableStorage.Get<MyEntity>("Table", "Partition").FirstOrDefault();
now throws the following exception:
Expression of type 'System.Linq.IOrderedQueryable`1[Microsoft.WindowsAzure.Storage.Table.DynamicTableEntity]' cannot be used for parameter of type 'System.Linq.IQueryable`1[CloudFxTest.MyEntity]' of method 'CloudFxTest.MyEntity FirstOrDefault[MyEntity](System.Linq.IQueryable`1[CloudFxTest.MyEntity])'

regards Kiran

1

There are 1 best solutions below

0
On

looks to me that the IQueryable is not fully supported, I got it working by using qry.ToList() in case if it helps anyone.