1
我很遗憾,如何在Azure表存储中实现此方法。 (注意:我对它很新颖)如何查询Azure表存储中的多个分区键?
public IList<string> GetUserConnections(int[] userIds)
{
string[] result = userIds.Select(x => x.ToString()).ToArray();
var queryResult = _table.CreateQuery<ConnectionEntity>().Where(n => result.Contains(n.PartitionKey));
return queryResult.Select(n => n.RowKey).ToList();
}
我在执行查询时遇到错误。
An exception of type 'System.NotSupportedException' occurred in
Microsoft.WindowsAzure.Storage.dll but was not handled in user code
Additional information: The method 'Contains' is not supported
这是我的ConnectionEntity。
public class ConnectionEntity:TableEntity
{
public ConnectionEntity()
{
}
public ConnectionEntity(int userId, string connectionId)
{
this.PartitionKey = userId.ToString();
this.RowKey = connectionId;
}
}
是否可以做一个Contains操作符?我似乎无法找到有关此类查询的文档。我应该考虑对分区键进行批量查询吗?
你是否设法做到底?我现在有一个循环结合他们: 'TableQuery.CombineFilters(expression,operatorString:“或”,filterB:nextPartitionKey)“,但我不能用它作为IQueryable,这是更可取的。我想我会抓住更多的数据,像Nathan所暗示的那样。 –
Matthew