IFeatureManagerSnapshot
The IFeatureManagerSnapshot service can be injected anywhere else more suitable helper methods aren't available.
private readonly IFeatureManagerSnapshot _featureManager;
public UsersController(IFeatureManagerSnapshot featureManager)
{
_featureManager = featureManager;
}
[Route("")]
public async Task<IActionResult> Index()
{
var feature1Enabled = await _featureManager.IsEnabledAsync(FeatureFlags.Feature1);
return View(feature1Enabled ? "Feature1Index" : "Index");
}
IFeatureManager is used by the FeatureMangerSnapshot to retrieve the computed value of each flag on each call, and it can be used the same way IFeatureManagerSnapshot is used.
Last updated
Was this helpful?