Share via


PostgresBuilderExtensions.WithPgWeb Method

Definition

Adds an administration and development platform for PostgreSQL to the application model using pgweb.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.PostgresServerResource> WithPgWeb (this Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.PostgresServerResource> builder, Action<Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Postgres.PgWebContainerResource>>? configureContainer = default, string? containerName = default);
static member WithPgWeb : Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.PostgresServerResource> * Action<Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Postgres.PgWebContainerResource>> * string -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.PostgresServerResource>
<Extension()>
Public Function WithPgWeb (builder As IResourceBuilder(Of PostgresServerResource), Optional configureContainer As Action(Of IResourceBuilder(Of PgWebContainerResource)) = Nothing, Optional containerName As String = Nothing) As IResourceBuilder(Of PostgresServerResource)

Parameters

builder
IResourceBuilder<PostgresServerResource>

The Postgres server resource builder.

configureContainer
Action<IResourceBuilder<PgWebContainerResource>>

Configuration callback for pgweb container resource.

containerName
String

The name of the container (Optional).

Returns

A reference to the IResourceBuilder<T>.

Examples

Use in application host with a Postgres resource

var builder = DistributedApplication.CreateBuilder(args);

var postgres = builder.AddPostgres("postgres")
   .WithPgWeb();
var db = postgres.AddDatabase("db");

var api = builder.AddProject<Projects.Api>("api")
  .WithReference(db);

builder.Build().Run();

Remarks

This version of the package defaults to the tag of the container image.

Applies to