microsoft / FeatureManagement-Dotnet

Microsoft.FeatureManagement provides standardized APIs for enabling feature flags within applications. Utilize this library to secure a consistent experience when developing applications that use patterns such as beta access, rollout, dark deployments, and more.
MIT License
1.05k stars 115 forks source link

Update Variant Example Application #437

Closed zhiyuanliang-ms closed 5 months ago

zhiyuanliang-ms commented 7 months ago

Why this PR?

Variant feature flags can be used in conjunction with dependency injection to surface different implementations of a service for different users.

This PR adds an example to demonstrate how to use VariantServiceProvider<T> to inject different implementations of an interface according to the assigned variant.

The example application is a web app that allows users to enter two numbers and the web app will calculate the sum. There are two variants of the calculation service: one will do the calculation on the server locally and the other will call an external API to do the calculation. This web app will do A/B test for these two variants.

For more details, please refer to the included README.

Visible Changes

zhiyuanliang-ms commented 5 months ago

@jimmyca15 I will merge this PR after #461 is merged. In this case, I can also add the example reference for README in this PR.