ResourceBuilderExtensions.WithExplicitStart<T> Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds a ExplicitStartupAnnotation annotation to the resource so it doesn't automatically start with the app host startup.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<T> WithExplicitStart<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T> builder) where T : Aspire.Hosting.ApplicationModel.IResource;
static member WithExplicitStart : Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResource)> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResource)> (requires 'T :> Aspire.Hosting.ApplicationModel.IResource)
<Extension()>
Public Function WithExplicitStart(Of T As IResource) (builder As IResourceBuilder(Of T)) As IResourceBuilder(Of T)
- T
The type of the resource.
- builder
- IResourceBuilder<T>
The resource builder.
The IResourceBuilder<T>.
The database clean up tool project isn't started with the app host. The resource start command can be used to run it ondemand later.
var builder = DistributedApplication.CreateBuilder(args);
var pgsql = builder.AddPostgres("postgres");
builder.AddProject<Projects.CleanUpDatabase>("dbcleanuptool")
.WithReference(pgsql)
.WithExplicitStart();
This method is useful when a resource shouldn't automatically start when the app host starts.
Produit | Versions |
---|---|
.NET Aspire | 9.1.0 |