共用方式為


DistributedApplication.Services Property

Definition

Gets the IServiceProvider instance configured for the application.

public IServiceProvider Services { get; }
member this.Services : IServiceProvider
Public ReadOnly Property Services As IServiceProvider

Property Value

Implements

Remarks

The DistributedApplication is an IHost implementation and as such exposes a Services property which allows developers to get services from the dependency injection container after DistributedApplication instance has been built using the Build() method.

To add services to the dependency injection container developers should use the Services property to access the IServiceCollection instance.

Applies to