我用Azure.Data.Tables. 我發現我很可能應該使用Azure.Data.Tables.TableServiceClient.QueryAsync(...)( docs ) 來列出表格,但是我找不到任何關于過濾器字串語法的檔案。我可以避免指定過濾器字串并在客戶端進行過濾,但這不是正確的方法。
檔案中只有一個示例:
filter
String
Returns only tables that satisfy the specified filter. For example, the following would filter tables with a Name of 'foo': "TableName eq 'foo'".
但是過濾器字串的完整檔案在哪里,更具體地說,如何按前綴列出表?Microsoft.Azure.Cosmos.Table.CloudTableClient.ListTables看起來它可以很容易地完成(檔案) ,但微軟建議轉移到Azure.Data.Tables.
uj5u.com熱心網友回復:
從 Azure.Data.Tables SDK 版本 12.4.0 開始,這是不可能的。
但是,我確實在 GitHub 上的 SDK 存盤庫上發現了一個問題:https ://github.com/Azure/azure-sdk-for-net/issues/24414 ,它為我指出了一個解決方法:https ://github.com/NuGet /Insights/blob/6d23681b17d7c131f7f2ab25b111fc4bcb421ba6/src/ExplorePackages.Logic/Storage/TableExtensions.cs。
從第二個鏈接:
public static AsyncPageable<TableItem> GetTablesAsync(this TableServiceClient client, string prefix)
{
var prefixQuery = TableClient.CreateQueryFilter<TableItem>(
x => x.TableName.CompareTo(prefix) >= 0
&& x.TableName.CompareTo(prefix char.MaxValue) <= 0);
return client.GetTablesAsync(filter: prefixQuery);
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/439314.html
