ClickHouse support for .NET Aspire.
$ dotnet add package ClickHouse.HostingProvides extension methods and resource definitions for a .NET Aspire AppHost to configure a ClickHouse resource.
In your AppHost project, install the .NET Aspire ClickHouse Hosting library with NuGet:
dotnet add package ClickHouse.Hosting
Then, in the Program.cs file of AppHost, add a ClickHouse resource and consume the connection using the following methods:
var db = builder.AddClickHouse("clickhouse")
.AddDatabase("default");
var api = builder.AddProject<Projects.ClickHouse_DemoApi>("api")
.WithReference(db);
When using the AddClickHouse method, you can specify the following optional parameters:
| Parameter | Description | Default Value |
|---|---|---|
userName | Username for ClickHouse authentication | - |
password | Password for ClickHouse authentication | - |
port | Port number for ClickHouse container | 8123 |
imageTag | Version tag of ClickHouse server image | "25.6" |
Contributions are welcome! Whether you're fixing a bug, adding a new feature, or improving the documentation, please feel free to make a pull request.