# AdminerBuilderExtensions Methods

- Package: [CommunityToolkit.Aspire.Hosting.Adminer](/reference/api/csharp/communitytoolkit.aspire.hosting.adminer.md)
- Type: [AdminerBuilderExtensions](/reference/api/csharp/communitytoolkit.aspire.hosting.adminer/adminerbuilderextensions.md)
- Kind: `Methods`
- Members: `2`

Provides extension methods for Adminer resources to an `Hosting.IDistributedApplicationBuilder`.

## AddAdminer(IDistributedApplicationBuilder, string, int?)

- Name: `AddAdminer(IDistributedApplicationBuilder, string, int?)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<AdminerContainerResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.Hosting.Adminer/AdminerBuilderExtensions.cs#L43-L82)

Adds a Adminer container resource to the application.

```csharp
public static class AdminerBuilderExtensions
{
    public static IResourceBuilder<AdminerContainerResource> AddAdminer(
        this IDistributedApplicationBuilder builder,
        string name,
        int? port = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IDistributedApplicationBuilder`)
  The resource builder.
- `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 to bind the underlying container to.

## Returns

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

## Remarks

Multiple [AdminerBuilderExtensions.AddAdminer(IDistributedApplicationBuilder, string, int?)](/reference/api/csharp/communitytoolkit.aspire.hosting.adminer/adminerbuilderextensions/methods.md#addadminer-idistributedapplicationbuilder-string-int) calls will return the same resource builder instance.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithHostPort(IResourceBuilder<AdminerContainerResource>, int?)

- Name: `WithHostPort(IResourceBuilder<AdminerContainerResource>, int?)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<AdminerContainerResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.Hosting.Adminer/AdminerBuilderExtensions.cs#L22-L27)

Configures the host port that the Adminer resource is exposed on instead of using randomly assigned port.

```csharp
public static class AdminerBuilderExtensions
{
    public static IResourceBuilder<AdminerContainerResource> WithHostPort(
        this IResourceBuilder<AdminerContainerResource> builder,
        int? port)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<AdminerContainerResource>`)
  The resource builder for Adminer.
- `port` (`int?`)
  The port to bind on the host. If `null` is used random port will be assigned.

## Returns

`IResourceBuilder<AdminerContainerResource>` -- The resource builder for Adminer.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.
