# AspireQdrantExtensions Methods

- Package: [Aspire.Qdrant.Client](/reference/api/csharp/aspire.qdrant.client.md)
- Type: [AspireQdrantExtensions](/reference/api/csharp/aspire.qdrant.client/aspireqdrantextensions.md)
- Kind: `Methods`
- Members: `2`

Provides extension methods for registering Qdrant-related services in an `Hosting.IHostApplicationBuilder`.

## AddKeyedQdrantClient(IHostApplicationBuilder, string, Action<QdrantClientSettings>)

- Name: `AddKeyedQdrantClient(IHostApplicationBuilder, string, Action<QdrantClientSettings>)`
- Modifiers: `extension`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Components/Aspire.Qdrant.Client/AspireQdrantExtensions.cs#L50-L53)

Registers `Client.QdrantClient` as a keyed singleton for the given `name` in the services provided by the `builder`. Configures logging for the `Client.QdrantClient`.

```csharp
public static class AspireQdrantExtensions
{
    public static void AddKeyedQdrantClient(
        this IHostApplicationBuilder builder,
        string name,
        Action<QdrantClientSettings>? configureSettings = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IHostApplicationBuilder`)
  The `Hosting.IHostApplicationBuilder` to read config from and add services to.
- `name` (`string`)
  The connection name to use to find a connection string.
- `configureSettings` (`Action<QdrantClientSettings>`) `optional`
  An optional method that can be used for customizing the [QdrantClientSettings](/reference/api/csharp/aspire.qdrant.client/qdrantclientsettings.md). It's invoked after the settings are read from the configuration.

## Exceptions

- `InvalidOperationException` -- If required ConnectionString is not provided in configuration section

## Remarks

Reads the configuration from "Aspire:Qdrant:Client" section.

## AddQdrantClient(IHostApplicationBuilder, string, Action<QdrantClientSettings>)

- Name: `AddQdrantClient(IHostApplicationBuilder, string, Action<QdrantClientSettings>)`
- Modifiers: `extension`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Components/Aspire.Qdrant.Client/AspireQdrantExtensions.cs#L34)

Registers `Client.QdrantClient` as a singleton in the services provided by the `builder`. Configures logging for the `Client.QdrantClient`.

```csharp
public static class AspireQdrantExtensions
{
    public static void AddQdrantClient(
        this IHostApplicationBuilder builder,
        string connectionName,
        Action<QdrantClientSettings>? configureSettings = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IHostApplicationBuilder`)
  The `Hosting.IHostApplicationBuilder` to read config from and add services to.
- `connectionName` (`string`)
  The connection name to use to find a connection string.
- `configureSettings` (`Action<QdrantClientSettings>`) `optional`
  An optional method that can be used for customizing the [QdrantClientSettings](/reference/api/csharp/aspire.qdrant.client/qdrantclientsettings.md). It's invoked after the settings are read from the configuration.

## Exceptions

- `InvalidOperationException` -- If required ConnectionString is not provided in configuration section

## Remarks

Reads the configuration from "Aspire:Qdrant:Client" section.
