PostgresBuilderExtensions Methods
Class Methods 2 members
Provides extension methods for adding PostgreSQL resources to an
Hosting.IDistributedApplicationBuilder. WithAdminer(IResourceBuilder<PostgresServerResource>, Action<IResourceBuilder<AdminerContainerResource>>, string?) Section titled WithAdminer(IResourceBuilder<PostgresServerResource>, Action<IResourceBuilder<AdminerContainerResource>>, string?) extension IResourceBuilder<PostgresServerResource> Adds an administration and development platform for PostgreSQL to the application model using Adminer.
public static class PostgresBuilderExtensions{ public static IResourceBuilder<PostgresServerResource> WithAdminer( this IResourceBuilder<PostgresServerResource> builder, Action<IResourceBuilder<AdminerContainerResource>>? configureContainer = null, string? containerName = null) { // ... }}Parameters
builder IResourceBuilder<PostgresServerResource> configureContainer Action<IResourceBuilder<AdminerContainerResource>> optional containerName string? optional Returns
IResourceBuilder<PostgresServerResource> A reference to the ApplicationModel.IResourceBuilder`1. Remarks
This version of the package defaults to the tag of the container image. The Postgres server resource builder. Configuration callback for Adminer container resource. The name of the container (Optional). Use in application host with a Postgres resource
var builder = DistributedApplication.CreateBuilder(args);
var postgres = builder.AddPostgres("postgres") .WithAdminer();var db = postgres.AddDatabase("db");
var api = builder.AddProject<Projects.Api>("api") .WithReference(db);
builder.Build().Run();WithDbGate(IResourceBuilder<PostgresServerResource>, Action<IResourceBuilder<DbGateContainerResource>>, string?) Section titled WithDbGate(IResourceBuilder<PostgresServerResource>, Action<IResourceBuilder<DbGateContainerResource>>, string?) extension IResourceBuilder<PostgresServerResource> Adds an administration and development platform for PostgreSQL to the application model using DbGate.
public static class PostgresBuilderExtensions{ public static IResourceBuilder<PostgresServerResource> WithDbGate( this IResourceBuilder<PostgresServerResource> builder, Action<IResourceBuilder<DbGateContainerResource>>? configureContainer = null, string? containerName = null) { // ... }}Parameters
builder IResourceBuilder<PostgresServerResource> The Postgres server resource builder. configureContainer Action<IResourceBuilder<DbGateContainerResource>> optional Configuration callback for DbGate container resource. containerName string? optional The name of the container (Optional). Returns
IResourceBuilder<PostgresServerResource> A reference to the ApplicationModel.IResourceBuilder`1. Remarks
This version of the package defaults to the tag of the container image.
Examples
Use in application host with a Postgres resource
var builder = DistributedApplication.CreateBuilder(args);
var postgres = builder.AddPostgres("postgres") .WithDbGate();var db = postgres.AddDatabase("db");
var api = builder.AddProject<Projects.Api>("api") .WithReference(db);
builder.Build().Run();