2015-09-30 90 views

回答

0

安裝完NuGet後,只需創建一個MyCouch.Client實例並將其傳遞給您的數據庫的URL。

using (var client = new MyCouchClient("http://127.0.0.1:5984/test")) 
{ 
    //Consume here 
} 

格式爲:{scheme}://[{username}:{password}]/{authority}/{localpath}。從v0.11.0開始,有一個特定的MyCouchUriBuilder可用於構建Uri。它會自動例如致電SetBasicCredentials時,將Uri.EscapeDataString應用於用戶名和密碼。

var uriBuilder = new MyCouchUriBuilder("http://localhost:5984/") 
    .SetDbName(TestConstants.TestDbName) 
    .SetBasicCredentials("[email protected]", "[email protected]"); 

return new MyCouchClient(uriBuilder.Build()); 

詳情Click Here