diff --git a/docs/database/includes/surrealdb-app-host.md b/docs/database/includes/surrealdb-app-host.md new file mode 100644 index 0000000000..851dfa60f8 --- /dev/null +++ b/docs/database/includes/surrealdb-app-host.md @@ -0,0 +1,18 @@ +To model the SurrealDB resource in the app host, install the [Aspire.Hosting.SurrealDb](https://www.nuget.org/packages/Aspire.Hosting.SurrealDb) NuGet package in the [app host](xref:aspire/app-host) project. + +### [.NET CLI](#tab/dotnet-cli) + +```dotnetcli +dotnet add package Aspire.Hosting.SurrealDb +``` + +### [PackageReference](#tab/package-reference) + +```xml + +``` + +--- + +In your app host project, register a SurrealDb database and consume the connection using the following methods: diff --git a/docs/database/surrealdb-integration.md b/docs/database/surrealdb-integration.md new file mode 100644 index 0000000000..be39f8afb1 --- /dev/null +++ b/docs/database/surrealdb-integration.md @@ -0,0 +1,47 @@ +--- +title: .NET Aspire SurrealDB integration +description: This article describes the .NET Aspire SurrealDB integration. +ms.topic: how-to +ms.date: 09/17/2024 +--- + +# .NET Aspire SurrealDB integration + + + +## App host usage + +[!INCLUDE [surrealdb-app-host](includes/surrealdb-app-host.md)] + +```csharp +var builder = DistributedApplication.CreateBuilder(args); + +var surrealServer = builder.AddSurrealServer("surreal"); +var surrealDb = mysql.AddDatabase("mydb", "ns", "db"); + +var myService = builder.AddProject() + .WithReference(surrealDb); +``` + +When you want to explicitly provide a root password, you can provide it as a parameter. Consider the following alternative example: + +```csharp +var password = builder.AddParameter("password", secret: true); + +var surrealServer = builder.AddSurrealServer("surreal", password); +var surrealDb = mysql.AddDatabase("mydb", "ns", "db"); + +var myService = builder.AddProject() + .WithReference(surrealDb); +``` + +For more information, see [External parameters](../fundamentals/external-parameters.md). + + + +## See also + +- [SurrealDB database](https://surrealdb.com/) +- [.NET SDK documentation for SurrealDB](https://surrealdb.com/docs/sdk/dotnet) +- [.NET Aspire integrations](../fundamentals/integrations-overview.md) +- [.NET Aspire GitHub repo](https://github.com/dotnet/aspire) diff --git a/docs/fundamentals/integrations-overview.md b/docs/fundamentals/integrations-overview.md index a7d3a9b0fd..0951308a4c 100644 --- a/docs/fundamentals/integrations-overview.md +++ b/docs/fundamentals/integrations-overview.md @@ -61,6 +61,7 @@ The following table lists the .NET Aspire integrations currently available for u | [Seq](../logging/seq-integration.md)
Seq logo. | [Aspire.Seq](https://www.nuget.org/packages/Aspire.Seq) | A library for logging to [Seq](https://datalust.co/seq). | | [SQL Server Entity Framework Core](../database/sql-server-entity-framework-integration.md)
SQL logo. | [Aspire.Microsoft.EntityFrameworkCore.SqlServer](https://www.nuget.org/packages/Aspire.Microsoft.EntityFrameworkCore.SqlServer) | A library for accessing [SQL Server databases using Entity Framework Core](/ef/core/providers/sql-server/). | | [SQL Server](../database/sql-server-integration.md)
SQL logo. | [Aspire.Microsoft.Data.SqlClient](https://www.nuget.org/packages/Aspire.Microsoft.Data.SqlClient) | A library for accessing [SQL Server](/sql/sql-server/) databases. | +| [SurrealDB](../database/surrealdb-integration.md)
SurrealDB logo. | [Aspire.Hosting.SurrealDb](https://www.nuget.org/packages/Aspire.Hosting.SurrealDb) | A library for accessing [SurrealDB](https://surrealdb.com/) databases. | For more information on working with .NET Aspire integrations in Visual Studio, see [Visual Studio tooling](setup-tooling.md#visual-studio-tooling). diff --git a/docs/fundamentals/media/icons/surrealdb.png b/docs/fundamentals/media/icons/surrealdb.png new file mode 100644 index 0000000000..c0a97d2bbe Binary files /dev/null and b/docs/fundamentals/media/icons/surrealdb.png differ diff --git a/docs/toc.yml b/docs/toc.yml index 0ed54cc801..c3bef67728 100644 --- a/docs/toc.yml +++ b/docs/toc.yml @@ -208,6 +208,9 @@ items: href: caching/stackexchange-redis-distributed-caching-integration.md?pivots=valkey - name: Redis output caching (Valkey) href: caching/stackexchange-redis-output-caching-integration.md?pivots=valkey + - name: Seq + displayName: seq,logging + href: logging/seq-integration.md - name: SQL Server items: - name: SQL Database - EF Core @@ -216,9 +219,9 @@ items: - name: SQL Database displayName: sql server,sql database href: database/sql-server-integration.md - - name: Seq - displayName: seq,logging - href: logging/seq-integration.md + - name: SurrealDB + displayName: surrealdb,kv,document,graph,temporal + href: database/surrealdb-integration.md - name: Deployment items: