RavenDB.NET Aspire integration
.NET Aspire is a framework for building cloud-ready distributed systems in .NET. It allows you to orchestrate your application along with all its dependencies, such as databases, observability tools, messaging, and more.
RavenDB now has full support for .NET Aspire. You can read the full details in this article, but here is a sneak peek.
Defining RavenDB deployment as part of your host definition:
using Projects;
var builder = DistributedApplication.CreateBuilder(args);
var serverResource = builder.AddRavenDB(name: "ravenServerResource");
var databaseResource = serverResource.AddDatabase(
name: "ravenDatabaseResource",
databaseName: "myDatabase");
builder.AddProject<RavenDBAspireExample_ApiService>("RavenApiService")
.WithReference(databaseResource)
.WaitFor(databaseResource);
builder.Build().Run();
And then making use of that in the API projects:
var builder = WebApplication.CreateBuilder(args);
builder.AddServiceDefaults();
builder.AddRavenDBClient(connectionName: "ravenDatabaseResource", configureSettings: settings =>
{
settings.CreateDatabase = true;
settings.DatabaseName = "myDatabase";
});
var app = builder.Build();
// here we’ll add some API endpoints shortly…
app.Run();
You can read all the details here. The idea is to make it easier & simpler for you to deploy RavenDB-based systems.
More posts in "RavenDB" series:
- (02 May 2025) May 2025
- (28 Jun 2024) June, 2024
Comments
Comment preview
Join the conversation...