# SolrBuilderExtensions Methods

- Package: [CommunityToolkit.Aspire.Hosting.Solr](/reference/api/csharp/communitytoolkit.aspire.hosting.solr.md)
- Type: [SolrBuilderExtensions](/reference/api/csharp/communitytoolkit.aspire.hosting.solr/solrbuilderextensions.md)
- Kind: `Methods`
- Members: `4`

Extension methods for adding and configuring a Solr resource.

## AddSolr(IDistributedApplicationBuilder, string, int?, string?)

- Name: `AddSolr(IDistributedApplicationBuilder, string, int?, string?)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<SolrResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.Hosting.Solr/SolrBuilderExtensions.cs#L25-L67)

Adds an Apache Solr container resource to the distributed application.

```csharp
public static class SolrBuilderExtensions
{
    public static IResourceBuilder<SolrResource> AddSolr(
        this IDistributedApplicationBuilder builder,
        string name,
        int? port = null,
        string? coreName = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IDistributedApplicationBuilder`)
  The `Hosting.IDistributedApplicationBuilder`.
- `name` (`string`)
  The name of the resource. This name will be used as the connection string name when referenced in a dependency.
- `port` (`int?`) `optional`
  The host port for Solr.
- `coreName` (`string?`) `optional`
  The name of the core to create.

## Returns

`IResourceBuilder<SolrResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1`.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithConfigset(IResourceBuilder<SolrResource>, string, string)

- Name: `WithConfigset(IResourceBuilder<SolrResource>, string, string)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<SolrResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.Hosting.Solr/SolrBuilderExtensions.cs#L80-L86)

Specifies the path to the config set directory.

```csharp
public static class SolrBuilderExtensions
{
    public static IResourceBuilder<SolrResource> WithConfigset(
        this IResourceBuilder<SolrResource> builder,
        string configSetName,
        string configSetPath)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<SolrResource>`)
  An `ApplicationModel.IResourceBuilder`1` representing the Solr resource.
- `configSetName` (`string`)
  The name of the config set.
- `configSetPath` (`string`)
  Path to the config set directory.

## Returns

`IResourceBuilder<SolrResource>` -- An `ApplicationModel.IResourceBuilder`1` that can be used to further customize the resource.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithDataBindMount(IResourceBuilder<SolrResource>, string, bool)

- Name: `WithDataBindMount(IResourceBuilder<SolrResource>, string, bool)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<SolrResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.Hosting.Solr/SolrBuilderExtensions.cs#L114-L117)

Adds a bind mount for the data folder to a Solr container resource.

```csharp
public static class SolrBuilderExtensions
{
    public static IResourceBuilder<SolrResource> WithDataBindMount(
        this IResourceBuilder<SolrResource> builder,
        string source,
        bool isReadOnly = false)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<SolrResource>`)
  The resource builder.
- `source` (`string`)
  The source directory on the host to mount into the container.
- `isReadOnly` (`bool`) `optional`
  A flag that indicates if this is a read-only mount.

## Returns

`IResourceBuilder<SolrResource>` -- The `ApplicationModel.IResourceBuilder`1`.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithDataVolume(IResourceBuilder<SolrResource>, string?, bool)

- Name: `WithDataVolume(IResourceBuilder<SolrResource>, string?, bool)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<SolrResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.Hosting.Solr/SolrBuilderExtensions.cs#L99-L101)

Adds a named volume for the data folder to a Solr container resource.

```csharp
public static class SolrBuilderExtensions
{
    public static IResourceBuilder<SolrResource> WithDataVolume(
        this IResourceBuilder<SolrResource> builder,
        string? name = null,
        bool isReadOnly = false)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<SolrResource>`)
  The resource builder.
- `name` (`string?`) `optional`
  The name of the volume. Defaults to an auto-generated name based on the application and resource names.
- `isReadOnly` (`bool`) `optional`
  A flag that indicates if this is a read-only volume.

## Returns

`IResourceBuilder<SolrResource>` -- The `ApplicationModel.IResourceBuilder`1`.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.
