我对couchdb和我的沙发很陌生。我试图实现一个非常简单的查询,我只想获取视图的结果并将其保存到我的DTO类中。
当我通过HTTP手动查询couchdb查询时,它可以工作:
http://localhost:5984/mydb/_design/tshirts/_view/getAllTshirts然而,当我尝试用我的沙发运行我的应用程序时,我无法运行它。我当前的查询:
using MyCouch.Requests;
using MyCouch.Responses;
// (...)
using (var client = new Client("http://localhost:5984/samples")) {
var query = new QueryViewRequest("getAllTshirts");
ViewQueryResponse<TShirt[]> result = await client.Views.QueryAsync<TShirt[]>(query);
Console.WriteLine (result);
}由于某些原因,它找不到Client类。我找到了一个在github上使用github的示例,正如您可以看到的那样,我使用的是与MyCouch相关的所有名称空间,如本例所示。
我还尝试使用MyCouchStore来代替:
using (var store = new MyCouchStore("http://localhost:5984/", "samples")) {
var query = new QueryViewRequest("getAllTshirts");
ViewQueryResponse<TShirt[]> result = await store.Views.QueryAsync<TShirt[]>(query);
Console.WriteLine (result);
}但是,store不包含任何名为Views的属性。有什么想法吗?如何使用MyCouch查询我的视图?
发布于 2016-02-21 23:02:58
显然,这些文件并不是最新的。构造函数现在需要两个参数,第二个参数是可选的引导程序。这对我起了作用:
var client = new Client("http://localhost:5984/samples", null)https://stackoverflow.com/questions/35532521
复制相似问题