本文整理汇总了C#中IView.Count方法的典型用法代码示例。如果您正苦于以下问题:C# IView.Count方法的具体用法?C# IView.Count怎么用?C# IView.Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IView
的用法示例。
在下文中一共展示了IView.Count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: viewPass
/// <summary>
/// Verifies all the properties of view and asserts true if it is not null, false otherwise
/// </summary>
/// <param name="view">Name of design view</param>
private void viewPass(IView<City> view)
{
foreach (var item in view)
{
Assert.That(item.Id, Is.Not.Null, "Item Id was null");
Assert.That(item.Name, Is.Not.Null, "Item Name was null");
Assert.That(item.State, Is.Not.Null, "Item State was null");
Assert.That(item.Type, Is.EqualTo("city"), "Type was not city");
Assert.That(item, Is.InstanceOf<City>(), "Item was not a City instance");
}
Assert.That(view.Count(), Is.GreaterThan(0), "View count was 0");
}
示例2: ExecuteView
private object ExecuteView(CouchbaseVisitor visitor, IView<IViewRow> couchbaseCursor)
{
object result = null;
if (couchbaseCursor == null)
{
return DefaultValueExecute(visitor.CallType);
}
if (visitor.OrderClause != null)
{
couchbaseCursor.Descending(visitor.OrderClause.Descending);
}
if (visitor.Skip != 0)
{
couchbaseCursor = couchbaseCursor.Skip(visitor.Skip);
}
if (visitor.Take != 0)
{
couchbaseCursor = couchbaseCursor.Limit(visitor.Take);
}
switch (visitor.CallType)
{
case Kooboo.CMS.Content.Query.Expressions.CallType.Count:
result = couchbaseCursor.Count();
break;
case Kooboo.CMS.Content.Query.Expressions.CallType.First:
return ViewRowToTextContent(couchbaseCursor.First());
case Kooboo.CMS.Content.Query.Expressions.CallType.Last:
return ViewRowToTextContent(couchbaseCursor.Last());
case Kooboo.CMS.Content.Query.Expressions.CallType.LastOrDefault:
return ViewRowToTextContent(couchbaseCursor.LastOrDefault());
case Kooboo.CMS.Content.Query.Expressions.CallType.FirstOrDefault:
return ViewRowToTextContent(couchbaseCursor.FirstOrDefault());
case Kooboo.CMS.Content.Query.Expressions.CallType.Unspecified:
default:
var uuidList = couchbaseCursor.Select(it => GetUUID(it)).ToArray();
return this.ContentQuery.Repository.GetClient().ExecuteGet(uuidList).Select(it => it.Value.ToContent());
}
return result;
}