【问题标题】:Couchbase .Net Library complex startKey/endKey typesCouchbase .Net 库复杂的 startKey/endKey 类型
【发布时间】:2012-06-21 14:48:57
【问题描述】:

我需要将这些参数从 REST-API 查询转换为 C# LINQ。

?descending=true&endkey=[35,37]&startkey=[35,37,{}]

在 LINQ 中,此查询如下所示:

c.GetView("MyView", "SubView").StartKey(startKey).EndKey(endKey).Descending(true);

变量startKey和endKey应该是什么类型?

我尝试过字符串,但在这种情况下,.Net 库会生成带有无效参数的查询:

?descending=true&endkey="[35,37]"&startkey="[35,37,{}]"

【问题讨论】:

    标签: c# .net rest couchbase


    【解决方案1】:

    我做了一些研究并找到了答案。根据https://github.com/couchbase/couchbase-net-client/blob/master/src/Couchbase/CouchbaseViewBase.cs#L320

    我终于找到了我的 LINQ 变量的类型:

    object[] startKey = new object[] { 35, 37, "{}" };

    object[] endKey = new object[] { 35, 37};

    和查询: >

    c.GetView("MyView", "SubView").StartKey(startKey).EndKey(endKey).Descending(true);

    【讨论】:

      猜你喜欢
      • 2015-06-09
      • 1970-01-01
      • 1970-01-01
      • 2015-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多