我正在使用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}
这如何使我更接近找到分区键是什么?

最佳答案

你试过用标准的cosmos.net客户端吗?

            var col = await CosmosClient.ReadDocumentCollectionAsync(UriFactory.CreateDocumentCollectionUri(
            dataBaseName,
            collectionName));

            var pathes = col.Resource.PartitionKey.Paths;

10-07 18:39