-
Notifications
You must be signed in to change notification settings - Fork 112
Description
.NET Aspire issue link
Overview
The Aspire framework does not currently support Neon, a modern, open-source serverless PostgreSQL-compatible database. It has managed integration for Azure as well. While it is possible to use the existing client integrations for PostgreSQL or Npgsql, Neon offers additional features like database branching that are not supported out of the box. We want to enable these unique features through dedicated .NET packages for Aspire.
Usage example
Here is an example of usage
Hosting Integration for Neon
To integrate open source Neon as a hosted resource in a .NET Aspire application:
Install the Aspire.Hosting.Neon
NuGet package:
dotnet add package Aspire.Hosting.Neon
Add the Neon server resource in the app host project:
var builder = DistributedApplication.CreateBuilder(args);
// Add Neon server resource with branching support
var neon = builder.AddNeonProject("neon");
// Add a Neon database
var neonDb = neon.AddDatabase("neondb");
// Reference the Neon database in a project
var exampleProject = builder.AddProject<Projects.ExampleProject>()
.WithReference(neonDb);
// Initialize and run the application
builder.Build().Run();
Client Integration for Neon
To enable client projects to connect to Neon:
Install the Aspire.Neon NuGet package:
dotnet add package Aspire.Neon
Add the Neon client to the Program.cs file in the client project:
builder.AddNeonDataSource("neondb").addBranch("dev");
Both integrations should align with Aspire's existing conventions and provide a similar experience to the PostgreSQL integration.
Additional context
We are looking for .NET Aspire experts from the community to help us in developing this integration. Let me know your feedback!
Help us help you
Yes, but only if others can assist