# AdoNetGrainStorageServiceCollectionExtensions Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.persistence.adonet/orleans.hosting.adonetgrainstorageservicecollectionextensions/)

## AddAdoNetGrainStorage(IServiceCollection, Action&lt;AdoNetGrainStorageOptions&gt;) {#addadonetgrainstorage-this-microsoft-extensions-dependencyinjection-iservicecoll-cf40079e}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.persistence.adonet/orleans.hosting.adonetgrainstorageservicecollectionextensions/methods/addadonetgrainstorage-this-microsoft-extensions-dependencyinjection-iservicecoll-cf40079e/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/AdoNet/Orleans.Persistence.AdoNet/Storage/Provider/AdoNetGrainStorageServiceCollectionExtensions.cs#L28)

```csharp
public static IServiceCollection AddAdoNetGrainStorage(this IServiceCollection services, Action<AdoNetGrainStorageOptions> configureOptions)
```

Configure silo to use AdoNet grain storage as the default grain storage. Instructions on configuring your database are available at [http://aka.ms/orleans-sql-scripts](http://aka.ms/orleans-sql-scripts).

### Parameters

- `services` (`IServiceCollection`)
- `configureOptions` (`Action<AdoNetGrainStorageOptions>`)

## AddAdoNetGrainStorage(IServiceCollection, string, Action&lt;AdoNetGrainStorageOptions&gt;) {#addadonetgrainstorage-this-microsoft-extensions-dependencyinjection-iservicecoll-231e0f62}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.persistence.adonet/orleans.hosting.adonetgrainstorageservicecollectionextensions/methods/addadonetgrainstorage-this-microsoft-extensions-dependencyinjection-iservicecoll-231e0f62/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/AdoNet/Orleans.Persistence.AdoNet/Storage/Provider/AdoNetGrainStorageServiceCollectionExtensions.cs)

```csharp
public static IServiceCollection AddAdoNetGrainStorage(this IServiceCollection services, string name, Action<AdoNetGrainStorageOptions> configureOptions)
```

Configure silo to use AdoNet grain storage for grain storage. Instructions on configuring your database are available at [http://aka.ms/orleans-sql-scripts](http://aka.ms/orleans-sql-scripts).

### Parameters

- `services` (`IServiceCollection`)
- `name` (`string`)
- `configureOptions` (`Action<AdoNetGrainStorageOptions>`)

## AddAdoNetGrainStorage(IServiceCollection, string, Action&lt;OptionsBuilder&lt;AdoNetGrainStorageOptions&gt;&gt;) {#addadonetgrainstorage-this-microsoft-extensions-dependencyinjection-iservicecoll-a9c40f4f}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.persistence.adonet/orleans.hosting.adonetgrainstorageservicecollectionextensions/methods/addadonetgrainstorage-this-microsoft-extensions-dependencyinjection-iservicecoll-a9c40f4f/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/AdoNet/Orleans.Persistence.AdoNet/Storage/Provider/AdoNetGrainStorageServiceCollectionExtensions.cs)

```csharp
public static IServiceCollection AddAdoNetGrainStorage(this IServiceCollection services, string name, Action<OptionsBuilder<AdoNetGrainStorageOptions>> configureOptions = null)
```

Configure silo to use AdoNet grain storage for grain storage. Instructions on configuring your database are available at [http://aka.ms/orleans-sql-scripts](http://aka.ms/orleans-sql-scripts).

### Parameters

- `services` (`IServiceCollection`)
- `name` (`string`)
- `configureOptions` (`Action<OptionsBuilder<AdoNetGrainStorageOptions>>`)

## AddAdoNetGrainStorageAsDefault(IServiceCollection, Action&lt;OptionsBuilder&lt;AdoNetGrainStorageOptions&gt;&gt;) {#addadonetgrainstorageasdefault-this-microsoft-extensions-dependencyinjection-ise-9ee513d0}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.persistence.adonet/orleans.hosting.adonetgrainstorageservicecollectionextensions/methods/addadonetgrainstorageasdefault-this-microsoft-extensions-dependencyinjection-ise-9ee513d0/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/AdoNet/Orleans.Persistence.AdoNet/Storage/Provider/AdoNetGrainStorageServiceCollectionExtensions.cs#L50)

```csharp
public static IServiceCollection AddAdoNetGrainStorageAsDefault(this IServiceCollection services, Action<OptionsBuilder<AdoNetGrainStorageOptions>> configureOptions = null)
```

Configure silo to use AdoNet grain storage as the default grain storage. Instructions on configuring your database are available at [http://aka.ms/orleans-sql-scripts](http://aka.ms/orleans-sql-scripts).

### Parameters

- `services` (`IServiceCollection`)
- `configureOptions` (`Action<OptionsBuilder<AdoNetGrainStorageOptions>>`)
