Skip to content

PackageManagementService

Jianyun edited this page Feb 25, 2016 · 5 revisions

PackageManagementService class

public class PackageManagementService {
	public IEnumerable<string> ProviderNames{get;}
	public IEnumerable<PackageProvider> PackageProviders {get;}
	public IEnumerable<PackageProvider> SelectProviders(string providerName, IHostApi requestObject);
	public IEnumerable<PackageProvider> SelectProvidersWithFeature(string featureString);  
}

PowerShell Example

    # special case: make sure that nuget is bootstrapped automagically 
	$request.PackageManagementService.SelectProvider("NuGet");

	$providers = $request.PackageManagementService.SelectProvidersWithFeature( "supports-powershell-modules");

	for-eachObject $providers  {
		packages = $_.FindPackages( ... );
		for-eachObject $providers  {
			Write-Out $_
		} 
	}

Property: PackageNames

Description

Returns a collection with the names of all the registered PackageProvider instances.

Return Value

An IEnumerable<string> with the names of all the registered PackageProvider instances.

Exceptions

Not expected to throw exceptions.

Property: PackageProviders

Description

Returns a collection with the instances of all the registered PackageProviders.

see PackageProvider Instance

Return Value

An IEnumerable<PackageProvider> with all the registered PackageProvider instances.

Exceptions

Not expected to throw exceptions.

Method: SelectProvider

Description

Returns a collection of PackageProvider instances that matches the given providerName and sources.

see PackageProvider Instance

Example

IEnumerable<PackageProvider> SelectProvidersBySource(string providerName, IEnumerable<string> sources)

Return Value

Returns a collection of PackageProvider instances that matches the given providerName and sources.

If there are no matches found given the critetria, an empty collection is returned.

Exceptions

Not expected to throw an exception.

Method: SelectProvidersWithFeature

Description

Returns a collection of PackageProvider instances that all report implementing a given feature.

see PackageProvider Instance

Example

IEnumerable<PackageProvider> SelectProvidersByFeature(string feature)

Return Value

Returns a collection of PackageProvider instances that matches the given providerName and sources.

If there are no matches found given the critetria, an empty collection is returned.

Exceptions

Not expected to throw an exception.

Clone this wiki locally