Skip to content
Docs Try Aspire

PostgresBuilderExtensions

Class static net10.0
📦 Aspire.Hosting.PostgreSQL v13.1.2
Provides extension methods for adding PostgreSQL resources to an Hosting.IDistributedApplicationBuilder.
namespace Aspire.Hosting;
public static class PostgresBuilderExtensions
{
// ...
}
AddDatabase(IResourceBuilder<PostgresServerResource>, string, string?)extension
IResourceBuilder<PostgresDatabaseResource>
Adds a PostgreSQL database to the application model.
AddPostgres(IDistributedApplicationBuilder, string, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>, int?)extension
IResourceBuilder<PostgresServerResource>
Adds a PostgreSQL resource to the application model. A container is used for local development.
WithCreationScript(IResourceBuilder<PostgresDatabaseResource>, string)extension
IResourceBuilder<PostgresDatabaseResource>
Defines the SQL script used to create the database.
WithDataBindMount(IResourceBuilder<PostgresServerResource>, string, bool)extension
IResourceBuilder<PostgresServerResource>
Adds a bind mount for the data folder to a PostgreSQL container resource.
WithDataVolume(IResourceBuilder<PostgresServerResource>, string?, bool)extension
IResourceBuilder<PostgresServerResource>
Adds a named volume for the data folder to a PostgreSQL container resource.
WithHostPort(IResourceBuilder<PgAdminContainerResource>, int?)extension
IResourceBuilder<PgAdminContainerResource>
Configures the host port that the PGAdmin resource is exposed on instead of using randomly assigned port.
WithHostPort(IResourceBuilder<PgWebContainerResource>, int?)extension
IResourceBuilder<PgWebContainerResource>
Configures the host port that the pgweb resource is exposed on instead of using randomly assigned port.
WithHostPort(IResourceBuilder<PostgresServerResource>, int?)extension
IResourceBuilder<PostgresServerResource>
Configures the host port that the PostgreSQL resource is exposed on instead of using randomly assigned port.
WithInitBindMount(IResourceBuilder<PostgresServerResource>, string, bool)extensionobsolete
IResourceBuilder<PostgresServerResource>
Adds a bind mount for the init folder to a PostgreSQL container resource.
WithInitFiles(IResourceBuilder<PostgresServerResource>, string)extension
IResourceBuilder<PostgresServerResource>
Copies init files to a PostgreSQL container resource.
WithPassword(IResourceBuilder<PostgresServerResource>, IResourceBuilder<ParameterResource>)extension
IResourceBuilder<PostgresServerResource>
Configures the password that the PostgreSQL resource is used.
WithPgAdmin(IResourceBuilder<T>, Action<IResourceBuilder<PgAdminContainerResource>>, string?)extension
IResourceBuilder<T>
Adds a pgAdmin 4 administration and development platform for PostgreSQL to the application model.
WithPgWeb(IResourceBuilder<PostgresServerResource>, Action<IResourceBuilder<PgWebContainerResource>>, string?)extension
IResourceBuilder<PostgresServerResource>
Adds an administration and development platform for PostgreSQL to the application model using pgweb. This version of the package defaults to the tag of the container image.
WithUserName(IResourceBuilder<PostgresServerResource>, IResourceBuilder<ParameterResource>)extension
IResourceBuilder<PostgresServerResource>
Configures the user name that the PostgreSQL resource is used.
View all methods