public void TableQueryableDynamicTableEntityQuery() { OperationContext opContext = new OperationContext(); Func <string, string> identityFunc = (s) => s; TableQuery <DynamicTableEntity> res = (from ent in complexEntityTable.CreateQuery <DynamicTableEntity>() where ent.PartitionKey == middleRef.PartitionKey && ent.Properties[identityFunc("DateTimeOffset")].DateTimeOffsetValue >= middleRef.DateTimeOffset select ent).WithContext(opContext); List <DynamicTableEntity> entities = res.ToList(); Assert.AreEqual(entities.Count, 50); }
public string RetrnRefusePCode(string pcode) { //create the storage account //maybe move the code to a controller based class and call the method from there CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString); CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); CloudTable table = tableClient.GetTableReference("Refuse"); TableQuery<Models.RefuseEntity> query = new TableQuery<Models.RefuseEntity>().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, pcode)); List<Models.RefuseEntity> refuse = query.ToList(); var json = JsonConvert.SerializeObject(refuse); return json; }