本文整理汇总了C#中Couchbase.N1QL.QueryRequest.GetRequestUri方法的典型用法代码示例。如果您正苦于以下问题:C# QueryRequest.GetRequestUri方法的具体用法?C# QueryRequest.GetRequestUri怎么用?C# QueryRequest.GetRequestUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Couchbase.N1QL.QueryRequest
的用法示例。
在下文中一共展示了QueryRequest.GetRequestUri方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_Statement
public void Test_Statement()
{
var query = new QueryRequest().
BaseUri(new Uri(string.Format("http://{0}:8093/query", _server))).
Statement("SELECT * FROM default");
var uri = query.GetRequestUri();
Assert.IsTrue(uri.ToString().Contains(":8093/query?statement=SELECT * FROM default"));
Console.WriteLine(uri);
}
示例2: Test_Positional_Parameters
public void Test_Positional_Parameters()
{
var query = new QueryRequest().
BaseUri(new Uri(string.Format("http://{0}:8093/query", _server))).
Statement("SELECT * FROM default WHERE type=$1").
AddPositionalParameter("dog");
var uri = query.GetRequestUri();
Console.WriteLine(uri);
Assert.IsTrue(uri.ToString().Contains(":8093/query?statement=SELECT * FROM default WHERE type=$1&args=[\"dog\"]"));
}
示例3: Test_Statement_ClientContextId
public void Test_Statement_ClientContextId()
{
var query = new QueryRequest().
BaseUri(new Uri(string.Format("http://{0}:8093/query", _server))).
Statement("SELECT * FROM default").
ClientContextId("somecontextlessthanorequalto64chars");
var uri = query.GetRequestUri();
Console.WriteLine(uri);
Assert.IsTrue(uri.ToString().Contains(":8093/query?statement=SELECT * FROM default&client_context_id=somecontextlessthanorequalto64chars"));
}
示例4: Test_Named_Parameters_Two_Arguments
public void Test_Named_Parameters_Two_Arguments()
{
var query = new QueryRequest().
BaseUri(new Uri(string.Format("http://{0}:8093/query", _server))).
Statement("SELECT * FROM default WHERE type=$canine OR type=$feline").
AddNamedParameter("canine", "dog").
AddNamedParameter("feline", "cat");
var uri = query.GetRequestUri();
Console.WriteLine(uri);
Assert.IsTrue(uri.ToString().Contains(":8093/query?statement=SELECT * FROM default WHERE type=$canine OR type=$feline&$canine=\"dog\"&$feline=\"cat\""));
}
示例5: When_Timeout_Set_Query_Contains_Milliseconds_With_Unit
public void When_Timeout_Set_Query_Contains_Milliseconds_With_Unit()
{
var query = new QueryRequest()
.BaseUri(new Uri(string.Format("http://{0}:8093/query", _server)))
.Statement("SELECT * FROM `beer-sample`")
.Timeout(new TimeSpan(0, 0, 0, 0, 5));
var uri = query.GetRequestUri();
Console.WriteLine(uri);
Assert.IsTrue(uri.ToString().Contains(":8093/query?statement=SELECT * FROM `beer-sample`&timeout=5ms"));
}
示例6: When_isAdmin_Is_False_Credentials_Contains_local
public void When_isAdmin_Is_False_Credentials_Contains_local()
{
var query = new QueryRequest().
BaseUri(new Uri(string.Format("http://{0}:8093/query", _server))).
Statement("SELECT * FROM authenticated").
AddCredentials("authenticated", "secret", false);
var uri = query.GetRequestUri();
Console.WriteLine(uri);
Assert.IsTrue(uri.ToString().Contains(":8093/query?statement=SELECT * FROM authenticated&creds=[{\"user\":\"local:authenticated\"%2C\"pass\":\"secret\"}]"));
}