本文整理汇总了C#中Query.Limit方法的典型用法代码示例。如果您正苦于以下问题:C# Query.Limit方法的具体用法?C# Query.Limit怎么用?C# Query.Limit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query.Limit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Can_prefetch_document_and_fill_ihasdocument
public void Can_prefetch_document_and_fill_ihasdocument()
{
var s2 = _cx.CreateSession("relax-query-tests");
var q = new Query<WidgetWithDocument>(s2, "widgets", "all-widgets");
var r0 = q.Limit(1).WithDocuments().Execute();
var e0 = r0.Rows.First().Entity;
Assert.That(e0.Document, Is.Not.Null);
}
示例2: Can_prefetch_documents_where_doc_is_already_enrolled
public void Can_prefetch_documents_where_doc_is_already_enrolled()
{
var q = new Query<Widget>(_sx, "widgets", "all-widgets");
var r0 = q.Limit(1).Execute();
var e0 = _sx.Load<Widget>(r0.Rows.First().Id);
var r1 = q.Limit(1).WithDocuments().Execute();
var e1 = r1.Rows.First().Entity;
Assert.IsNotNull(e1);
Assert.AreSame(e0, e1);
}
示例3: Can_page_through_results
public void Can_page_through_results()
{
var q = new Query<Widget>(_sx, "widgets", "all-widgets");
var r = q.Limit(2).Execute();
Assert.AreEqual(3, r.Total);
Assert.AreEqual(2, r.Rows.Length);
r = r.Next();
Assert.AreEqual(3, r.Total);
Assert.AreEqual(1, r.Rows.Length);
r = r.Next();
Assert.IsNull(r);
}
示例4: Can_load_through_id
public void Can_load_through_id()
{
var q = new Query<Widget>(_sx, "widgets", "all-widgets");
var r = q.Limit(1).Execute();
var o = r.Rows.First().Entity;
Assert.IsNotNull(o);
}
示例5: Can_execute_query_with_result_limit
public void Can_execute_query_with_result_limit()
{
var q = new Query<Widget>(_sx, "widgets", "all-widgets");
var r = q.Limit(2).Execute();
Assert.AreEqual(r.Total, 3);
Assert.AreEqual(r.Rows.Length, 2);
}