Salta ai contenuti
Docs Try Aspire
Docs Try

Use community extensions for MySQL hosting

Questi contenuti non sono ancora disponibili nella tua lingua.

⭐ Community Toolkit MySQL logo

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

This package provides the following features:

To get started with the Aspire Community Toolkit MySQL hosting extensions, install the CommunityToolkit.Aspire.Hosting.MySql.Extensions NuGet package in the AppHost project.

Aspire CLI — Aggiungi pacchetto CommunityToolkit.Aspire.Hosting.MySql.Extensions
aspire add communitytoolkit-mysql-extensions

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

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

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

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

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

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var mysql = builder.AddMySql("mysql")
.WithDbGate();
builder.AddProject<Projects.ExampleProject>("api")
.WithReference(mysql);
builder.Build().Run();

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

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

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var mysql = builder.AddMySql("mysql")
.WithAdminer();
builder.AddProject<Projects.ExampleProject>("api")
.WithReference(mysql);
builder.Build().Run();

This adds a new Adminer resource to the AppHost 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 MySQL resource:

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var mysql = builder.AddMySql("mysql")
.WithDbGate()
.WithAdminer();
builder.AddProject<Projects.ExampleProject>("api")
.WithReference(mysql);
builder.Build().Run();