Перейти до вмісту

GO Feature Flag Client integration reference

Цей контент ще не доступний вашою мовою.

⭐ Community Toolkit goff logo

To get started with the Aspire GO Feature Flag integrations, follow the Get started with GO Feature Flag integrations guide.

This article includes full details about the Aspire GO Feature Flag Client integration.

To access the types and APIs for the GO Feature Flag client integration, install the 📦 CommunityToolkit.Aspire.GoFeatureFlag NuGet package in the client-consuming project:

.NET CLI — Add CommunityToolkit.Aspire.GoFeatureFlag package
dotnet add package CommunityToolkit.Aspire.GoFeatureFlag

In the Program.cs file of your client-consuming project, call the AddGoFeatureFlagClient extension method to register a GoFeatureFlagProvider for use via the dependency injection container. The method takes a connection name parameter.

builder.AddGoFeatureFlagClient(connectionName: "goff");

You can then retrieve the GoFeatureFlagProvider instance using dependency injection:

public class ExampleService(GoFeatureFlagProvider provider)
{
// Use provider...
}

There might be situations where you want to register multiple GoFeatureFlagProvider instances with different connection names. To register keyed goff clients, call the AddKeyedGoFeatureFlagClient method:

builder.AddKeyedGoFeatureFlagClient(name: "technical");
builder.AddKeyedGoFeatureFlagClient(name: "business");

Then you can retrieve the GoFeatureFlagProvider instances using dependency injection:

public class ExampleService(
[FromKeyedServices("technical")] GoFeatureFlagProvider technicalProvider,
[FromKeyedServices("business")] GoFeatureFlagProvider businessProvider)
{
// Use providers...
}

The Aspire goff integration uses the configured client to perform a health check.