Thanks to visit codestin.com
Credit goes to aspire.dev

Salta ai contenuti
Docs Try Aspire
Docs Try

Use community extensions for PostgreSQL hosting

Questi contenuti non sono ancora disponibili nella tua lingua.

⭐ Community Toolkit PostgreSQL logo

The Aspire Community Toolkit PostgreSQL hosting extensions package provides extra functionality to the Aspire.Hosting.PostgreSQL hosting package.

This package provides the following features:

To get started with the Aspire Community Toolkit PostgreSQL hosting extensions, install the CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions NuGet package in the app host project.

Aspire CLI — Aggiungi pacchetto CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions
aspire add communitytoolkit-postgresql-extensions

La CLI Aspire è interattiva; seleziona il risultato corretto quando richiesto:

Aspire CLI — Output di esempio
Select an integration to add:
> communitytoolkit-postgresql-extensions (CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions)
> Other results listed as selectable options...

For TypeScript AppHosts, add the Community Toolkit PostgreSQL extensions package to aspire.config.json:

aspire.config.json
{
"packages": {
"CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions": "*"
}
}

To add the DbGate management UI to your PostgreSQL resource, call the WithDbGate method on the PostgresServerResource instance:

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var postgres = builder.AddPostgres("postgres")
.WithDbGate();
builder.AddProject<Projects.ExampleProject>()
.WithReference(postgres);
// After adding all resources, run the app...

This adds a new DbGate resource to the app host which is available from the Aspire dashboard. DbGate is a comprehensive database management tool that provides a web-based interface for managing your PostgreSQL databases.

To add the Adminer management UI to your PostgreSQL resource, call the WithAdminer method on the PostgresServerResource instance:

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var postgres = builder.AddPostgres("postgres")
.WithAdminer();
builder.AddProject<Projects.ExampleProject>()
.WithReference(postgres);
// After adding all resources, run the app...

This adds a new Adminer resource to the app host which is available from the Aspire dashboard. Adminer is a lightweight database management tool that provides a simple web interface for database operations.

You can use both management UIs together on the same PostgreSQL resource:

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var postgres = builder.AddPostgres("postgres")
.WithDbGate()
.WithAdminer();
builder.AddProject<Projects.ExampleProject>()
.WithReference(postgres);
// After adding all resources, run the app...