本文整理汇总了C#中PagedList.Any方法的典型用法代码示例。如果您正苦于以下问题:C# PagedList.Any方法的具体用法?C# PagedList.Any怎么用?C# PagedList.Any使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PagedList
的用法示例。
在下文中一共展示了PagedList.Any方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FetchAndIncludeReplies
private void FetchAndIncludeReplies(CommentDbContext dbContext, PagedList<Comment> parentComments, CommentSearchCondition commentSearchCondition, bool fetchCountOnly)
{
if (parentComments == null || !parentComments.Any()) return;
var parentCommentIds = parentComments.Select(x => x.Id).ToArray();
var childComments = dbContext.Comments.Where(x => parentCommentIds.Contains(x.ParentId));
foreach (var parent in parentComments)
{
if (fetchCountOnly)
{
parent.Replies = childComments.Where(child => child.ParentId == parent.Id).OrderByDescending(p => p.CreatedOn).ToPagedList(true);
}
else
{
parent.Replies = childComments.Where(child => child.ParentId == parent.Id).OrderByDescending(p => p.CreatedOn).ToPagedList(commentSearchCondition.PageNumber, commentSearchCondition.PageSize);
FetchAndIncludeReplies(dbContext, parent.Replies, commentSearchCondition, true);
}
}
}