forked from moattarwork/Easify
-
Notifications
You must be signed in to change notification settings - Fork 0
Feature Management
moattarwork edited this page Dec 14, 2022
·
1 revision
LittleBlocks uses the feature management capability from .NET Core https://docs.microsoft.com/en-us/azure/azure-app-configuration/use-feature-flags-dotnet-core.
The feature management is integrated into LittleBlocks and when a developer bootstraps the API with LittleBlocks, the IFeatureManager can be injected into any dependent class. Here is an example:
public class FeatureDependentClass
{
private readonly IFeatureManager _featureManager;
public FeatureDependentClass(IFeatureManager featureManager)
{
_featureManager = featureManager ?? throw new ArgumentNullException(nameof(featureManager));
}
public async Task<Result> GetResultBasedOnFeature(string name)
{
if (!await _featureManager.IsEnabledAsync("feature name"))
return Result.Success();
return Result.Fail();
}
}