When you use Windows Azure Table Storage cloudtableclient to query Azure for data, you find that the GUID type of the custom class is always unable to successfully query out the data, and the GUID values are consistent and the original code is as follows:
PublicUserentity Getuserbytoken (stringtoken) { varTable =AzureTableContext.CloudTableClientContext.GetTableReference (userentity.tablename); varquery =NewTablequery<userentity>() . Where (Tablequery.generatefiltercondition ("Token", querycomparisons.equal, token)); returntable. ExecuteQuery (query). FirstOrDefault (); }
Modify Tablequery.generatefiltercondition to Tablequery.generatefilterconditionforguid and modify the following code as follows:
PublicUserentity Getuserbytoken (stringtoken) { varTable =AzureTableContext.CloudTableClientContext.GetTableReference (userentity.tablename); varquery =NewTablequery<userentity>() . Where (Tablequery.generatefilterconditionforguid ("Token", Querycomparisons.equal, Guid.parse (token)); returntable. ExecuteQuery (query). FirstOrDefault (); }
Finally the data can be queried by the GUID
Windows Azure Table Storage resolves Guid query issues