public IEnumerable <IPackage> GetUpdates(IEnumerable <IPackage> packages, bool includePrerelease, bool includeAllVersions, IEnumerable <FrameworkName> targetFramework) { if (!Context.SupportsServiceMethod(GetUpdatesSvcMethod)) { // If there's no search method then we can't filter by target framework return(PackageRepositoryExtensions.GetUpdatesCore(this, packages, includePrerelease, includeAllVersions, targetFramework)); } // Pipe all the things! string ids = String.Join("|", packages.Select(p => p.Id)); string versions = String.Join("|", packages.Select(p => p.Version.ToString())); string targetFrameworkValue = targetFramework.IsEmpty() ? "" : String.Join("|", targetFramework.Select(VersionUtility.GetShortFrameworkName)); var serviceParameters = new Dictionary <string, object> { { "packageIds", "'" + ids + "'" }, { "versions", "'" + versions + "'" }, { "includePrerelease", ToString(includePrerelease) }, { "includeAllVersions", ToString(includeAllVersions) }, { "targetFrameworks", "'" + Escape(targetFrameworkValue) + "'" }, }; var query = Context.CreateQuery <DataServicePackage>(GetUpdatesSvcMethod, serviceParameters); return(new SmartDataServiceQuery <DataServicePackage>(Context, query)); }
public IEnumerable <IPackage> FindPackagesById(string packageId) { try { if (!Context.SupportsServiceMethod(FindPackagesByIdSvcMethod)) { // If there's no search method then we can't filter by target framework return(PackageRepositoryExtensions.FindPackagesByIdCore(this, packageId)); } var serviceParameters = new Dictionary <string, object> { { "id", "'" + UrlEncodeOdataParameter(packageId) + "'" } }; // Create a query for the search service method var query = Context.CreateQuery <DataServicePackage>(FindPackagesByIdSvcMethod, serviceParameters); return(new SmartDataServiceQuery <DataServicePackage>(Context, query)); } catch (Exception ex) { var message = string.Format( CultureInfo.CurrentCulture, NuGetResources.ErrorLoadingPackages, _httpClient.OriginalUri, ex.Message); throw new InvalidOperationException(message, ex); } }
public IEnumerable <IPackage> FindPackagesById(string packageId) { if (!Context.SupportsServiceMethod(FindPackagesByIdSvcMethod)) { // If there's no search method then we can't filter by target framework return(PackageRepositoryExtensions.FindPackagesByIdCore(this, packageId)); } var serviceParameters = new Dictionary <string, object> { { "id", "'" + Escape(packageId) + "'" } }; // Create a query for the search service method var query = Context.CreateQuery <DataServicePackage>(FindPackagesByIdSvcMethod, serviceParameters); return(new SmartDataServiceQuery <DataServicePackage>(Context, query)); }