Aspire.Qdrant.Client
A Qdrant client that integrates with Aspire, including logging.
Deprecated Package Version
Reason: Other, Legacy
This version is out of support and is no longer maintained. Please upgrade to the latest version. See our support policy for details: https://aka.ms/dotent/aspire/support
Install
| Product | Versions |
|---|---|
| .NET |
README
Aspire.Qdrant.Client library
Registers a QdrantClient in the DI container for connecting to a Qdrant server.
Getting started
Prerequisites
- Qdrant server and connection string for accessing the server API endpoint.
Install the package
Install the .NET Aspire Qdrant Client library with NuGet:
dotnet add package Aspire.Qdrant.Client
Usage example
In the Program.cs file of your project, call the AddQdrantClient extension method to register a QdrantClient for use via the dependency injection container. The method takes a connection name parameter.
builder.AddQdrantClient("qdrant");
Configuration
The .NET Aspire Qdrant Client component provides multiple options to configure the server connection based on the requirements and conventions of your project.
Use a connection string
When using a connection string from the ConnectionStrings configuration section, you can provide the name of the connection string when calling builder.AddQdrantClient():
builder.AddQdrantClient("qdrant");
And then the connection string will be retrieved from the ConnectionStrings configuration section:
{
"ConnectionStrings": {
"qdrant": "Endpoint=http://localhost:6334;Key=123456!@#$%"
}
}
By default the QdrantClient uses the gRPC API endpoint.
Use configuration providers
The .NET Aspire Qdrant Client component supports Microsoft.Extensions.Configuration. It loads the QdrantSettings from configuration by using the Aspire:Qdrant:Client key. Example appsettings.json that configures some of the options:
{
"Aspire": {
"Qdrant": {
"Client": {
"Key": "123456!@#$%"
}
}
}
}
Use inline delegates
Also you can pass the Action<QdrantSettings> configureSettings delegate to set up some or all the options inline, for example to set the API key from code:
builder.AddQdrantClient("qdrant", settings => settings.ApiKey = "12345!@#$%");
AppHost extensions
In your AppHost project, install the Aspire.Hosting.Qdrant library with NuGet:
dotnet add package Aspire.Hosting.Qdrant
Then, in the Program.cs file of AppHost, register a Qdrant server and consume the connection using the following methods:
var qdrant = builder.AddQdrant("qdrant");
var myService = builder.AddProject<Projects.MyService>()
.WithReference(qdrant);
The WithReference method configures a connection in the MyService project named qdrant. In the Program.cs file of MyService, the Qdrant connection can be consumed using:
builder.AddQdrantClient("qdrant");
Additional documentation
- https://github.com/qdrant/qdrant-dotnet
- https://github.com/dotnet/aspire/tree/main/src/Components/README.md
Feedback & contributing
https://github.com/dotnet/aspire
Qdrant, and the Qdrant logo are trademarks or registered trademarks of Qdrant Solutions GmbH of Germany, and used with their permission.
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.