1

I am trying to query a proget server using the Nuget.Core API. This method:

using System.IO.Packaging;
public IEnumerable<IPackage> GetAllProgramPackages(string feedUrl)
{
    var repository = PackageRepositoryFactory.Default.CreateRepository(feedUrl);            
    var query = repository.GetPackages();            
    var programPackages = query.Where(p => p.Tags.Contains("ClientPackage"));    
    return programPackages;

}

Should, as I understands it, return only packages where Tags contains "ClientPackage". It actually returns the entire repository, which is not desirable. I could always filter client-side after the query returns, but with a couple of thousand nuget packages in our repository, it wouldn't be a good option.

Is it possible to run a OData query for tags against a proget server, and have it executed server-side?

4

1 回答 1

1

是的,您可以过滤匹配项上的任何属性substringof(类似于Contains()C#)。只需使用:

http://proget/nuget/Default/Packages()?$filter=substringof(tags,'ClientPackage')
于 2014-09-25T14:52:55.893 回答