共用方式為


ResourceBuilderExtensions Class

Definition

Provides extension methods for configuring resources with environment variables.

public static class ResourceBuilderExtensions
type ResourceBuilderExtensions = class
Public Module ResourceBuilderExtensions
Inheritance
ResourceBuilderExtensions

Methods

AsHttp2Service<T>(IResourceBuilder<T>)

Configures a resource to mark all endpoints' transport as HTTP/2. This is useful for HTTP/2 services that need prior knowledge.

ExcludeFromManifest<T>(IResourceBuilder<T>)

Excludes a resource from being published to the manifest.

GetEndpoint<T>(IResourceBuilder<T>, String)

Gets an EndpointReference by name from the resource. These endpoints are declared either using WithEndpoint<T>(IResourceBuilder<T>, Nullable<Int32>, Nullable<Int32>, String, String, String, Boolean, Nullable<Boolean>) or by launch settings (for project resources). The EndpointReference can be used to resolve the address of the endpoint in WithEnvironment<T>(IResourceBuilder<T>, Action<EnvironmentCallbackContext>).

WaitFor<T>(IResourceBuilder<T>, IResourceBuilder<IResource>)

Waits for the dependency resource to enter the Running state before starting the resource.

WaitForCompletion<T>(IResourceBuilder<T>, IResourceBuilder<IResource>, Int32)

Waits for the dependency resource to enter the Exited or Finished state before starting the resource.

WithArgs<T>(IResourceBuilder<T>, Action<CommandLineArgsCallbackContext>)

Adds a callback to be executed with a list of command-line arguments when a container resource is started.

WithArgs<T>(IResourceBuilder<T>, Func<CommandLineArgsCallbackContext,Task>)

Adds a callback to be executed with a list of command-line arguments when a container resource is started.

WithArgs<T>(IResourceBuilder<T>, Object[])

Adds the arguments to be passed to a container resource when the container is started.

WithArgs<T>(IResourceBuilder<T>, String[])

Adds the arguments to be passed to a container resource when the container is started.

WithCommand<T>(IResourceBuilder<T>, String, String, Func<ExecuteCommandContext, Task<ExecuteCommandResult>>, Func<UpdateCommandStateContext,ResourceCommandState>, String, Object, String, String, Nullable<IconVariant>, Boolean)

Adds a ResourceCommandAnnotation to the resource annotations to add a resource command.

WithConnectionStringRedirection<T>(IResourceBuilder<T>, IResourceWithConnectionString)

Registers a callback which is invoked when a connection string is requested for a resource.

WithEndpoint<T>(IResourceBuilder<T>, Nullable<Int32>, Nullable<Int32>, String, String, String, Boolean, Nullable<Boolean>)

Exposes an endpoint on a resource. This endpoint reference can be retrieved using GetEndpoint<T>(IResourceBuilder<T>, String). The endpoint name will be the scheme name if not specified.

WithEndpoint<T>(IResourceBuilder<T>, String, Action<EndpointAnnotation>, Boolean)

Changes an existing creates a new endpoint if it doesn't exist and invokes callback to modify the defaults.

WithEnvironment<T>(IResourceBuilder<T>, Action<EnvironmentCallbackContext>)

Allows for the population of environment variables on a resource.

WithEnvironment<T>(IResourceBuilder<T>, Func<EnvironmentCallbackContext,Task>)

Allows for the population of environment variables on a resource.

WithEnvironment<T>(IResourceBuilder<T>, String, EndpointReference)

Adds an environment variable to the resource with the endpoint for endpointReference.

WithEnvironment<T>(IResourceBuilder<T>, String, Func<String>)

Adds an environment variable to the resource.

WithEnvironment<T>(IResourceBuilder<T>, String, IResourceBuilder<IResourceWithConnectionString>)

Adds an environment variable to the resource with the connection string from the referenced resource.

WithEnvironment<T>(IResourceBuilder<T>, String, IResourceBuilder<ParameterResource>)

Adds an environment variable to the resource with the value from parameter.

WithEnvironment<T>(IResourceBuilder<T>, String, ReferenceExpression)

Adds an environment variable to the resource.

WithEnvironment<T>(IResourceBuilder<T>, String, ReferenceExpression+ExpressionInterpolatedStringHandler)

Adds an environment variable to the resource.

WithEnvironment<T>(IResourceBuilder<T>, String, String)

Adds an environment variable to the resource.

WithExternalHttpEndpoints<T>(IResourceBuilder<T>)

Marks existing http or https endpoints on a resource as external.

WithHealthCheck<T>(IResourceBuilder<T>, String)

Adds a HealthCheckAnnotation to the resource annotations to associate a resource with a named health check managed by the health check service.

WithHttpEndpoint<T>(IResourceBuilder<T>, Nullable<Int32>, Nullable<Int32>, String, String, Boolean)

Exposes an HTTP endpoint on a resource. This endpoint reference can be retrieved using GetEndpoint<T>(IResourceBuilder<T>, String). The endpoint name will be "http" if not specified.

WithHttpHealthCheck<T>(IResourceBuilder<T>, String, Nullable<Int32>, String)

Adds a health check to the resource which is mapped to a specific endpoint.

WithHttpsEndpoint<T>(IResourceBuilder<T>, Nullable<Int32>, Nullable<Int32>, String, String, Boolean)

Exposes an HTTPS endpoint on a resource. This endpoint reference can be retrieved using GetEndpoint<T>(IResourceBuilder<T>, String). The endpoint name will be "https" if not specified.

WithHttpsHealthCheck<T>(IResourceBuilder<T>, String, Nullable<Int32>, String)

Adds a health check to the resource which is mapped to a specific endpoint.

WithManifestPublishingCallback<T>(IResourceBuilder<T>, Action<ManifestPublishingContext>)

Registers a callback which is invoked when manifest is generated for the app model.

WithManifestPublishingCallback<T>(IResourceBuilder<T>, Func<ManifestPublishingContext,Task>)

Registers an async callback which is invoked when manifest is generated for the app model.

WithReference<TDestination>(IResourceBuilder<TDestination>, EndpointReference)

Injects service discovery information from the specified endpoint into the project resource using the source resource's name as the service name. Each endpoint will be injected using the format "services__{sourceResourceName}{endpointName}{endpointIndex}={uriString}."

WithReference<TDestination>(IResourceBuilder<TDestination>, IResourceBuilder<IResourceWithConnectionString>, String, Boolean)

Injects a connection string as an environment variable from the source resource into the destination resource, using the source resource's name as the connection string name (if not overridden). The format of the environment variable will be "ConnectionStrings__{sourceResourceName}={connectionString}."

Each resource defines the format of the connection string value. The underlying connection string value can be retrieved using GetConnectionStringAsync(CancellationToken).

Connection strings are also resolved by the configuration system (appSettings.json in the AppHost project, or environment variables). If a connection string is not found on the resource, the configuration system will be queried for a connection string using the resource's name.

WithReference<TDestination>(IResourceBuilder<TDestination>, IResourceBuilder<IResourceWithServiceDiscovery>)

Injects service discovery information as environment variables from the project resource into the destination resource, using the source resource's name as the service name. Each endpoint defined on the project resource will be injected using the format "services__{sourceResourceName}{endpointName}{endpointIndex}={uriString}."

WithReference<TDestination>(IResourceBuilder<TDestination>, String, Uri)

Injects service discovery information as environment variables from the uri into the destination resource, using the name as the service name. The uri will be injected using the format "services__{name}__default__0={uri}."

Applies to