# AspireGoFeatureFlagExtensions Methods

- Package: [CommunityToolkit.Aspire.GoFeatureFlag](/reference/api/csharp/communitytoolkit.aspire.gofeatureflag.md)
- Type: [AspireGoFeatureFlagExtensions](/reference/api/csharp/communitytoolkit.aspire.gofeatureflag/aspiregofeatureflagextensions.md)
- Kind: `Methods`
- Members: `2`

Provides extension methods for registering GO Feature Flag-related services in an `Hosting.IHostApplicationBuilder`.

## AddGoFeatureFlagClient(IHostApplicationBuilder, string, Action<GoFeatureFlagClientSettings>)

- Name: `AddGoFeatureFlagClient(IHostApplicationBuilder, string, Action<GoFeatureFlagClientSettings>)`
- Modifiers: `extension`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.GoFeatureFlag/AspireGoFeatureFlagExtensions.cs#L34-L37)

Registers [GoFeatureFlagClientSettings](/reference/api/csharp/communitytoolkit.aspire.gofeatureflag/gofeatureflagclientsettings.md) as a singleton in the services provided by the `builder`.

```csharp
public static class AspireGoFeatureFlagExtensions
{
    public static void AddGoFeatureFlagClient(
        this IHostApplicationBuilder builder,
        string connectionName,
        Action<GoFeatureFlagClientSettings>? configureSettings = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IHostApplicationBuilder`)
  The `Hosting.IHostApplicationBuilder` to read config from and add services to.
- `connectionName` (`string`)
  The connection name to use to find a connection string.
- `configureSettings` (`Action<GoFeatureFlagClientSettings>`) `optional`
  An optional method that can be used for customizing the `GOFeatureFlag.GOFeatureFlagProviderOptions`. It's invoked after the settings are read from the configuration.

## Exceptions

- `InvalidOperationException` -- If required ConnectionString is not provided in configuration section

## Remarks

Reads the configuration from "Aspire:GoFeatureFlag:Client" section.

## AddKeyedGoFeatureFlagClient(IHostApplicationBuilder, string, Action<GoFeatureFlagClientSettings>)

- Name: `AddKeyedGoFeatureFlagClient(IHostApplicationBuilder, string, Action<GoFeatureFlagClientSettings>)`
- Modifiers: `extension`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.GoFeatureFlag/AspireGoFeatureFlagExtensions.cs#L52-L55)

Registers [GoFeatureFlagClientSettings](/reference/api/csharp/communitytoolkit.aspire.gofeatureflag/gofeatureflagclientsettings.md) as a keyed singleton for the given `name` in the services provided by the `builder`.

```csharp
public static class AspireGoFeatureFlagExtensions
{
    public static void AddKeyedGoFeatureFlagClient(
        this IHostApplicationBuilder builder,
        string name,
        Action<GoFeatureFlagClientSettings>? configureSettings = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IHostApplicationBuilder`)
  The `Hosting.IHostApplicationBuilder` to read config from and add services to.
- `name` (`string`)
  The connection name to use to find a connection string.
- `configureSettings` (`Action<GoFeatureFlagClientSettings>`) `optional`
  An optional method that can be used for customizing the `GOFeatureFlag.GOFeatureFlagProviderOptions`. It's invoked after the settings are read from the configuration.

## Exceptions

- `InvalidOperationException` -- If required ConnectionString is not provided in configuration section

## Remarks

Reads the configuration from "Aspire:GoFeatureFlag:Client" section.
