当前位置: 首页>>代码示例>>C#>>正文


C# IQueryable.AsBufferedEnumerable方法代码示例

本文整理汇总了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);
 }
开发者ID:MyLoadTest,项目名称:VuGenAddinManager,代码行数:4,代码来源:NuGetAddInsViewModelBase.cs

示例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;
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:49,代码来源:GetPackageCommand.cs

示例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;
        }
开发者ID:grendello,项目名称:nuget,代码行数:22,代码来源:GetPackageCommand.cs


注:本文中的IQueryable.AsBufferedEnumerable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。