# HostingExtensions.AddCosmosGrainStorageAsDefault(ISiloBuilder, Action&lt;CosmosGrainStorageOptions&gt;, Type)

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.persistence.cosmos/orleans.hosting.hostingextensions/) | [Methods](/orleans/docs/api/csharp/microsoft.orleans.persistence.cosmos/orleans.hosting.hostingextensions/methods/)

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

```csharp
public static ISiloBuilder AddCosmosGrainStorageAsDefault(this ISiloBuilder builder, Action<CosmosGrainStorageOptions> configureOptions, Type customPartitionKeyProviderType)
```

Configure silo to use Azure Cosmos DB storage as the default grain storage using a custom Partition Key Provider.

### Parameters

- `builder` (`ISiloBuilder`): The silo builder.
- `configureOptions` (`Action<CosmosGrainStorageOptions>`): The delegate used to configure the provider.
- `customPartitionKeyProviderType` (`Type`): The custom partition key provider type.
