There are no comments for GalleryFeedContext in the schema.
상속: global::System.Data.Services.Client.DataServiceContext
        /// <summary>
        /// Retrieves the number of extensions from a feed source.
        /// </summary>
        /// <param name="packagingSource">The packaging source from where to get the extensions.</param>
        /// <param name="query">The optional query to retrieve the extensions.</param>
        /// <returns>The number of extensions from a feed source.</returns>
        public int GetExtensionCount(PackagingSource packagingSource = null, Func<IQueryable<PublishedPackage>, IQueryable<PublishedPackage>> query = null)
        {
            return (packagingSource == null ? GetSources() : new[] { packagingSource })
                .Sum( source => {
                        var galleryFeedContext = new GalleryFeedContext(new Uri(source.FeedUrl));
                        IQueryable<PublishedPackage> packages = galleryFeedContext.Packages;

                        if (query != null) {
                            packages = query(packages);
                        }

                        return packages.Count();
                    }
                );
        }
예제 #2
0
        private static IEnumerable<PackagingEntry> GetExtensionListFromSource(bool includeScreenshots, PackagingSource packagingSource, Func<IQueryable<PublishedPackage>, IQueryable<PublishedPackage>> query, PackagingSource source) {
            var galleryFeedContext = new GalleryFeedContext(new Uri(source.FeedUrl)) { IgnoreMissingProperties = true };

            // Setup compression
            galleryFeedContext.SendingRequest += (o, e) => {
                if (e.Request is HttpWebRequest) {
                    (e.Request as HttpWebRequest).AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
                }
            };

            // Include screenshots if needed
            IQueryable<PublishedPackage> packages = includeScreenshots
                ? galleryFeedContext.Packages.Expand("Screenshots")
                : galleryFeedContext.Packages;
                        
            if (query != null) {
                packages = query(packages);
            }

            return packages.ToList().Select(p => CreatePackageEntry(p, packagingSource, galleryFeedContext.GetReadStreamUri(p)));
        }
        /// <summary>
        /// Retrieves the list of extensions from a feed source.
        /// </summary>
        /// <param name="includeScreenshots">Specifies if screenshots should be included in the result.</param>
        /// <param name="packagingSource">The packaging source from where to get the extensions.</param>
        /// <param name="query">The optional query to retrieve the extensions.</param>
        /// <returns>The list of extensions.</returns>
        public IEnumerable<PackagingEntry> GetExtensionList(bool includeScreenshots, PackagingSource packagingSource = null, Func<IQueryable<PublishedPackage>, IQueryable<PublishedPackage>> query = null)
        {
            return (packagingSource == null ? GetSources() : new[] {packagingSource})
                .SelectMany(
                    source => {
                        var galleryFeedContext = new GalleryFeedContext(new Uri(source.FeedUrl));
                        IQueryable<PublishedPackage> packages = includeScreenshots
                            ? galleryFeedContext.Packages.Expand("Screenshots")
                            : galleryFeedContext.Packages;

                        if (query != null) {
                            packages = query(packages);
                        }

                        return packages.ToList().Select(p => CreatePackageEntry(p, packagingSource, galleryFeedContext.GetReadStreamUri(p)));
                    }
                );
        }