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)); }