本文整理汇总了C#中IQueryable.AsBufferedEnumerable方法的典型用法代码示例。如果您正苦于以下问题:C# IQueryable.AsBufferedEnumerable方法的具体用法?C# IQueryable.AsBufferedEnumerable怎么用?C# IQueryable.AsBufferedEnumerable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IQueryable
的用法示例。
在下文中一共展示了IQueryable.AsBufferedEnumerable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBufferedPackages
private static IEnumerable<IPackage> GetBufferedPackages(IQueryable<IPackage> allPackages)
{
return allPackages.AsBufferedEnumerable(30);
}
示例2: FilterPackages
protected virtual IEnumerable<IPackage> FilterPackages(IPackageRepository sourceRepository, IQueryable<IPackage> packages)
{
if (CollapseVersions)
{
// In the event the client is going up against a v1 feed, do not try to fetch pre release packages since this flag does not exist.
if (IncludePrerelease && sourceRepository.SupportsPrereleasePackages)
{
// Review: We should change this to show both the absolute latest and the latest versions but that requires changes to our collapsing behavior.
packages = packages.Where(p => p.IsAbsoluteLatestVersion);
}
else
{
packages = packages.Where(p => p.IsLatestVersion);
}
}
if (UseRemoteSourceOnly && _firstValueSpecified)
{
// Optimization: If First parameter is specified, we'll wrap the IQueryable in a BufferedEnumerable to prevent consuming the entire result set.
packages = packages.AsBufferedEnumerable(First * 3).AsQueryable();
}
IEnumerable<IPackage> packagesToDisplay = packages.AsEnumerable()
.Where(PackageExtensions.IsListed);
// When querying a remote source, collapse versions unless AllVersions is specified.
// We need to do this as the last step of the Queryable as the filtering occurs on the client.
if (CollapseVersions)
{
// Review: We should perform the Listed check over OData for better perf
packagesToDisplay = packagesToDisplay.AsCollapsed();
}
if (ListAvailable && !IncludePrerelease)
{
// If we aren't collapsing versions, and the pre-release flag is not set, only display release versions when displaying from a remote source.
// We don't need to filter packages when showing installed packages.
packagesToDisplay = packagesToDisplay.Where(p => p.IsReleaseVersion());
}
packagesToDisplay = packagesToDisplay.Skip(Skip);
if (_firstValueSpecified)
{
packagesToDisplay = packagesToDisplay.Take(First);
}
return packagesToDisplay;
}
示例3: FilterPackages
protected virtual IEnumerable<IPackage> FilterPackages(IQueryable<IPackage> packages)
{
if (UseRemoteSourceOnly && _firstValueSpecified) {
// Optimization: If First parameter is specified, we'll wrap the IQueryable in a BufferedEnumerable to prevent consuming the entire result set.
packages = packages.AsBufferedEnumerable(First * 3).AsQueryable();
}
IEnumerable<IPackage> packagesToDisplay = packages;
// When querying a remote source, collapse versions unless AllVersions is specified.
// We need to do this as the last step of the Queryable as the filtering occurs on the client.
if (CollapseVersions) {
packagesToDisplay = packagesToDisplay.DistinctLast(PackageEqualityComparer.Id, PackageComparer.Version);
}
packagesToDisplay = packagesToDisplay.Skip(Skip);
if (_firstValueSpecified) {
packagesToDisplay = packagesToDisplay.Take(First);
}
return packagesToDisplay;
}