我正在使用 RESTfull HTTP 请求来获取集合的分区键。我在做:
response = client.GetStringAsync(new Uri(baseUri, resourceLink)).Result;
var data3 = (JObject)JsonConvert.DeserializeObject(response);
if (data3["partitionKey"] != null)
{
string partitionKey = data3["partitionKey"]["paths"][0].ToString();
string PartitionKey = partitionKey.Substring(1);
return PartitionKey;
}
有没有更有效的方法来做到这一点?他们的 SDK 是否有直接获取分区密钥的方法?
更新
我对获取分区键范围的回应是:
item={
"_rid": "lIB0ALrgyAACAAAAAAAAUA==",
"id": "0",
"_etag": "\"00000000-0000-0000-0318-18b49de501d4\"",
"minInclusive": "",
"maxExclusive": "FF",
"ridPrefix": 0,
"_self": "dbs/lIB0AA==/colls/lIB0ALrgyAA=/pkranges/lIB0ALrgyAACAAAAAAAAUA==/",
"throughputFraction": 1.0,
"status": "online",
"parents": [],
"_ts": 1528895512
}
这如何让我接近找出分区键是什么?