コンテンツにスキップ
ドキュメントAspire を試す
ドキュメント試す

Use community extensions for SQL Server hosting

このコンテンツはまだ日本語訳がありません。

⭐ Community Toolkit SQL Server logo

The Aspire Community Toolkit SQL Server hosting extensions package provides extra functionality to the Aspire.Hosting.SqlServer hosting package.

This package provides the following features:

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

Aspire CLI — CommunityToolkit.Aspire.Hosting.SqlServer.Extensions パッケージを追加
aspire add communitytoolkit-sqlserver-extensions

Aspire CLI は対話的です。求められたら適切な結果を選択してください:

Aspire CLI — 出力例
Select an integration to add:
> communitytoolkit-sqlserver-extensions (CommunityToolkit.Aspire.Hosting.SqlServer.Extensions)
> Other results listed as selectable options...

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

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

To add the DbGate management UI, decorate the official SqlServerServerResource builder with WithDbGate / withDbGate:

apphost.mts
import { createBuilder } from './.aspire/modules/aspire.mjs';
const builder = await createBuilder();
const sqlserver = await builder.addSqlServer('sqlserver');
await sqlserver.withDbGate();
const api = await builder.addProject('api', '../Api/Api.csproj');
await api.withReference(sqlserver);
await 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 SQL Server databases.

To add the Adminer management UI, decorate the official SqlServerServerResource builder with WithAdminer / withAdminer:

apphost.mts
import { createBuilder } from './.aspire/modules/aspire.mjs';
const builder = await createBuilder();
const sqlserver = await builder.addSqlServer('sqlserver');
await sqlserver.withAdminer();
const api = await builder.addProject('api', '../Api/Api.csproj');
await api.withReference(sqlserver);
await 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 SQL Server resource:

apphost.mts
import { createBuilder } from './.aspire/modules/aspire.mjs';
const builder = await createBuilder();
const sqlserver = await builder.addSqlServer('sqlserver');
await sqlserver.withDbGate();
await sqlserver.withAdminer();
const api = await builder.addProject('api', '../Api/Api.csproj');
await api.withReference(sqlserver);
await builder.build().run();

dbx is a lightweight, web-based database client and an alternative management UI to DbGate and Adminer. Use WithDbx / withDbx to add a dbx child resource configured for the SQL Server resource:

apphost.mts
import { createBuilder } from './.aspire/modules/aspire.mjs';
const builder = await createBuilder();
const sqlserver = await builder.addSqlServer('sqlserver');
await sqlserver.withDbx({
containerName: 'sqlserver-dbx',
imageTag: '0.5.33',
});
await builder.build().run();

The C# overload accepts an optional container configuration callback and containerName. The TypeScript binding accepts optional containerName and imageTag values.