.NET Aspire 社区工具包PostgreSQL 托管扩展

包括:托管集成已包括仅限于—Client集成不包括Client集成不包括

注意

此集成是 .NET.NET Aspire 社区工具包 的一部分, 不受 .NET.NET Aspire 团队正式支持。

在本文中,你将了解 .NET Aspire Community Toolkit PostgreSQL 托管扩展包,该包为 .NET AspirePostgreSQL 托管包提供额外的功能

此包提供以下功能:

托管集成

若要开始使用 .NET Aspire Community Toolkit PostgreSQL 托管扩展,请在 AppHost 项目中安装 📦 CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions NuGet 包。

dotnet add package CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions

有关详细信息,请参阅 dotnet add package在 .NET 应用程序中管理包依赖项

示例用法

若要将 DbGate 管理 UI 添加到 PostgreSQL 资源,请在 WithDbGate 实例上调用 PostgresServerResource 方法。

var postgresServer = builder.AddPostgreSQL("PostgreSQL")
    .WithDbGate();

若要将 Adminer 管理 UI 添加到PostgreSQL资源,请在PostgresServerResource实例上调用WithAdminer方法。

var postgresServer = builder.AddPostgreSQL("PostgreSQL")
    .WithAdminer();

这会向应用主机添加新资源,该资源可以从 .NET.NET Aspire 仪表板访问。