# HostingExtensions Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.clustering.cosmos/orleans.hosting.hostingextensions/)

## UseCosmosClustering(IServiceCollection, Action&lt;CosmosClusteringOptions&gt;) {#usecosmosclustering-this-microsoft-extensions-dependencyinjection-iservicecollec-df00f5c8}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.clustering.cosmos/orleans.hosting.hostingextensions/methods/usecosmosclustering-this-microsoft-extensions-dependencyinjection-iservicecollec-df00f5c8/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Azure/Orleans.Clustering.Cosmos/HostingExtensions.cs)

```csharp
public static IServiceCollection UseCosmosClustering(this IServiceCollection services, Action<CosmosClusteringOptions> configureOptions)
```

Adds clustering backed by Azure Cosmos DB.

### Parameters

- `services` (`IServiceCollection`): The service collection.
- `configureOptions` (`Action<CosmosClusteringOptions>`): The delegate used to configure the provider.

### Returns

The provided `services`.

## UseCosmosClustering(IServiceCollection, Action&lt;OptionsBuilder&lt;CosmosClusteringOptions&gt;&gt;) {#usecosmosclustering-this-microsoft-extensions-dependencyinjection-iservicecollec-3b9566b3}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.clustering.cosmos/orleans.hosting.hostingextensions/methods/usecosmosclustering-this-microsoft-extensions-dependencyinjection-iservicecollec-3b9566b3/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Azure/Orleans.Clustering.Cosmos/HostingExtensions.cs)

```csharp
public static IServiceCollection UseCosmosClustering(this IServiceCollection services, Action<OptionsBuilder<CosmosClusteringOptions>> configureOptions)
```

Adds clustering backed by Azure Cosmos DB.

### Parameters

- `services` (`IServiceCollection`): The service collection.
- `configureOptions` (`Action<OptionsBuilder<CosmosClusteringOptions>>`): The delegate used to configure the provider.

### Returns

The provided `services`.

## UseCosmosClustering(ISiloBuilder) {#usecosmosclustering-this-orleans-hosting-isilobuilder-51673f75}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.clustering.cosmos/orleans.hosting.hostingextensions/methods/usecosmosclustering-this-orleans-hosting-isilobuilder-51673f75/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Azure/Orleans.Clustering.Cosmos/HostingExtensions.cs#L47-L49)

```csharp
public static ISiloBuilder UseCosmosClustering(this ISiloBuilder builder)
```

Adds clustering backed by Azure Cosmos DB.

### Parameters

- `builder` (`ISiloBuilder`): The silo builder.

### Returns

The provided `builder`.

## UseCosmosClustering(ISiloBuilder, Action&lt;CosmosClusteringOptions&gt;) {#usecosmosclustering-this-orleans-hosting-isilobuilder-system-action-orleans-clus-2ecf3afb}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.clustering.cosmos/orleans.hosting.hostingextensions/methods/usecosmosclustering-this-orleans-hosting-isilobuilder-system-action-orleans-clus-2ecf3afb/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Azure/Orleans.Clustering.Cosmos/HostingExtensions.cs)

```csharp
public static ISiloBuilder UseCosmosClustering(this ISiloBuilder builder, Action<CosmosClusteringOptions> configureOptions)
```

Adds clustering backed by Azure Cosmos DB.

### Parameters

- `builder` (`ISiloBuilder`): The silo builder.
- `configureOptions` (`Action<CosmosClusteringOptions>`): The delegate used to configure the provider.

### Returns

The provided `builder`.

## UseCosmosClustering(ISiloBuilder, Action&lt;OptionsBuilder&lt;CosmosClusteringOptions&gt;&gt;) {#usecosmosclustering-this-orleans-hosting-isilobuilder-system-action-microsoft-ex-5764edc4}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.clustering.cosmos/orleans.hosting.hostingextensions/methods/usecosmosclustering-this-orleans-hosting-isilobuilder-system-action-microsoft-ex-5764edc4/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Azure/Orleans.Clustering.Cosmos/HostingExtensions.cs)

```csharp
public static ISiloBuilder UseCosmosClustering(this ISiloBuilder builder, Action<OptionsBuilder<CosmosClusteringOptions>> configureOptions)
```

Adds clustering backed by Azure Cosmos DB.

### Parameters

- `builder` (`ISiloBuilder`): The silo builder.
- `configureOptions` (`Action<OptionsBuilder<CosmosClusteringOptions>>`): The delegate used to configure the provider.

### Returns

The provided `builder`.

## UseCosmosGatewayListProvider(IClientBuilder) {#usecosmosgatewaylistprovider-this-orleans-hosting-iclientbuilder-efcdd6ea}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.clustering.cosmos/orleans.hosting.hostingextensions/methods/usecosmosgatewaylistprovider-this-orleans-hosting-iclientbuilder-efcdd6ea/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Azure/Orleans.Clustering.Cosmos/HostingExtensions.cs#L73-L75)

```csharp
public static IClientBuilder UseCosmosGatewayListProvider(this IClientBuilder builder)
```

Adds clustering backed by Azure Cosmos DB.

### Parameters

- `builder` (`IClientBuilder`): The client builder.

### Returns

The provided `builder`.

## UseCosmosGatewayListProvider(IClientBuilder, Action&lt;CosmosClusteringOptions&gt;) {#usecosmosgatewaylistprovider-this-orleans-hosting-iclientbuilder-system-action-o-eb4f6704}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.clustering.cosmos/orleans.hosting.hostingextensions/methods/usecosmosgatewaylistprovider-this-orleans-hosting-iclientbuilder-system-action-o-eb4f6704/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Azure/Orleans.Clustering.Cosmos/HostingExtensions.cs)

```csharp
public static IClientBuilder UseCosmosGatewayListProvider(this IClientBuilder builder, Action<CosmosClusteringOptions> configureOptions)
```

Adds clustering backed by Azure Cosmos DB.

### Parameters

- `builder` (`IClientBuilder`): The client builder.
- `configureOptions` (`Action<CosmosClusteringOptions>`): The delegate used to configure the provider.

### Returns

The provided `builder`.

## UseCosmosGatewayListProvider(IClientBuilder, Action&lt;OptionsBuilder&lt;CosmosClusteringOptions&gt;&gt;) {#usecosmosgatewaylistprovider-this-orleans-hosting-iclientbuilder-system-action-m-0eb9153f}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.clustering.cosmos/orleans.hosting.hostingextensions/methods/usecosmosgatewaylistprovider-this-orleans-hosting-iclientbuilder-system-action-m-0eb9153f/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Azure/Orleans.Clustering.Cosmos/HostingExtensions.cs)

```csharp
public static IClientBuilder UseCosmosGatewayListProvider(this IClientBuilder builder, Action<OptionsBuilder<CosmosClusteringOptions>> configureOptions)
```

Adds clustering backed by Azure Cosmos DB.

### Parameters

- `builder` (`IClientBuilder`): The client builder.
- `configureOptions` (`Action<OptionsBuilder<CosmosClusteringOptions>>`): The delegate used to configure the provider.

### Returns

The provided `builder`.

## UseCosmosGatewayListProvider(IServiceCollection, Action&lt;CosmosClusteringOptions&gt;) {#usecosmosgatewaylistprovider-this-microsoft-extensions-dependencyinjection-iserv-59af3ba3}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.clustering.cosmos/orleans.hosting.hostingextensions/methods/usecosmosgatewaylistprovider-this-microsoft-extensions-dependencyinjection-iserv-59af3ba3/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Azure/Orleans.Clustering.Cosmos/HostingExtensions.cs)

```csharp
public static IServiceCollection UseCosmosGatewayListProvider(this IServiceCollection services, Action<CosmosClusteringOptions> configureOptions)
```

Adds clustering backed by Azure Cosmos DB.

### Parameters

- `services` (`IServiceCollection`): The service collection.
- `configureOptions` (`Action<CosmosClusteringOptions>`): The delegate used to configure the provider.

### Returns

The provided `services`.

## UseCosmosGatewayListProvider(IServiceCollection, Action&lt;OptionsBuilder&lt;CosmosClusteringOptions&gt;&gt;) {#usecosmosgatewaylistprovider-this-microsoft-extensions-dependencyinjection-iserv-83c76eac}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.clustering.cosmos/orleans.hosting.hostingextensions/methods/usecosmosgatewaylistprovider-this-microsoft-extensions-dependencyinjection-iserv-83c76eac/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Azure/Orleans.Clustering.Cosmos/HostingExtensions.cs)

```csharp
public static IServiceCollection UseCosmosGatewayListProvider(this IServiceCollection services, Action<OptionsBuilder<CosmosClusteringOptions>> configureOptions)
```

Adds clustering backed by Azure Cosmos DB.

### Parameters

- `services` (`IServiceCollection`): The service collection.
- `configureOptions` (`Action<OptionsBuilder<CosmosClusteringOptions>>`): The delegate used to configure the provider.

### Returns

The provided `services`.
