Releases: microsoft/FeatureManagement-Dotnet
2.5.0
Microsoft.FeatureManagement Updates
The packages associated with this release are
Enhancements
- Updated
FeatureGateAttribute
to support Razor pages. This attribute can be placed on Razor page handlers to control access to the page based on whether a feature flag is on or off. (#166)
Bug fix
- Fixed an issue in
PercentageFilter
where a feature may occasionally be considered as on even when the filter is set to 0 percent. (#156)
2.4.0
Microsoft.FeatureManagement Updates
The packages associated with this release are
Enhancements
- Added option to throw when attempting to evaluate a missing feature. (#140)
IFeatureManagementSnapshot
is now thread-safe. (#141)
Bug fix
FilterAliasAttribute
now uses the proper parameter name in anArgumentNullException
ifalias
is null.
2.3.0
Microsoft.FeatureManagement Updates
The packages associated with this release are
Features
net5.0 Targeting
The net5.0 framework has been added to the list of target frameworks. This change resolves dependency issues for ASP.NET Core 5.0 applications.
Bug fix
- The license URL for these packages has been fixed.
2.2.0
Microsoft.FeatureManagement Updates
The packages associated with this release are
Stable Release
No changes have been made in this version. This is the first stable release with the targeting feature filter (introduced in 2.1.0-preview) and custom feature providers (introduced in 2.2.0-preview).
2.2.0-preview
Microsoft.FeatureManagement Updates
The packages associated with this release are
Preview Release
A new set of APIs has been added to support custom feature providers. These APIs can be considered to be in preview.
Features
Custom Feature Providers
Implementing a custom feature provider enables developers to to read feature flags from sources such as a database or a feature management service. For more information on the concept of custom feature providers and how to use this new feature take a look at the project's readme.
Netcoreapp3.1 Targeting
The netcoreapp3.1 framework has been added to the list of target frameworks. This change resolves dependency issues for ASP.NET Core 3.1 applications.
2.1.0-preview
Microsoft.FeatureManagement Updates
The packages associated with this release are
Preview Release
A new set of APIs has been added to support targeting. The targeting experience can be considered to be in preview.
Features
Targeting
Targeting enables developers to progressively roll out features to a target audience that can be increased gradually. For more information on the concept of targeting and how to use this new feature take a look at the project's readme.
2.0.0
Microsoft.FeatureManagement Updates
The packages associated with this release are
Stable Release
This release is the first stable release of the Microsoft.FeatureManagement libraries.
Features
Enumerating Feature Names
The IFeatureManager
interface now exposes a way to enumerate all feature names that are registered in the system. This enables work flows where the states of all known features need to be evaluated.
IFeatureManager fm;
await foreach (string featureName in fm.GetFeatureNamesAsync())
{
await IsEnabledAsync(featureName);
}
Important: Using the await foreach
syntax requires using version 8.0 or above of C#.
Missing Feature Filters
When the feature manager tries to evaluate the state of a feature that depends on a missing feature filter it will now throw a FeatureManagementException
with the error MissingFeatureFilter
.
The new fail-fast behavior can be disabled via feature management options if the old behavior to ignore missing feature filters is desired.
services.Configure<FeatureManagementOptions>(options =>
{
options.IgnoreMissingFeatureFilters = true;
});
Breaking Changes
- FeatureManager now throws a
FeatureManagementException
with errorAmbiguousFeatureFilter
, instead ofInvalidOperationException
, if a feature makes an ambiguous reference to two or more feature filters. Task<bool> ISessionManager.TryGetAsync(string featureName, out bool enabled)
has been changed toTask<bool?> ISessionManager.GetAsync(string featureName)
to enable async implementations.
2.0.0-preview-010610001-1263
Microsoft.FeatureManagement Updates
The packages associated with this release are
- Microsoft.FeatureManagement 2.0.0-preview-010610001-1263
- Microsoft.FeatureManagement.AspNetCore 2.0.0-preview-010610001-1263
Major Version Bump
This release introduces some new features and some breaking changes, thus the major version has been bumped to 2.
Features
Async Feature Filters
Support for async feature filters has been added. This results in the entire feature management pipeline being asynchronous. Async feature filters pave the way to performing async workloads in feature filters if desired.
Before
IFeatureManager fm;
if (fm.IsEnabled("MyFeature"))
{
}
After
IFeatureManager fm;
if (await fm.IsEnabledAsync("MyFeature"))
{
}
Floating Context Support
The original design for the feature management library relied on applications to have an ambient context. An application's ambient context could be used in feature filters to obtain information such as user identity and other information relevant when toggling features. This led to a disconnect in console applications which do not have an ambient context in most cases. Now application's without an ambient context can float a context into the feature management system by using the new IFeatureManager.IsEnabledAsync<TContext>(string feature, TContext context)
method. The context
parameter is able to be consumed by feature filters that implement IContextualFeatureFilter
.
Consumption
The ability to pass a context when evaluating a feature has been added to IFeatureManager
.
IFeatureManager fm = services.GetRequiredService<IFeatureManager>();
await fm.IsEnabledAsync("featureName", new MyApplicationContext
{
UserId = "someUser"
});
Contextual Feature Filters
Contextual feature filters are feature filters that can utilize a context provided by the application when evaluating whether a feature is on or off. Contextual feature filters are a generic type. Their generic type parameter describes the interface that the passed in context must implement for the filter to be able to evaluate it.
As an example, IContextualFeatureFilter<IAccountContext>
requires a context that implements IAccountContext
to be passed in. If a feature is checked for enabled and a context is provided that does not implement IAccountContext
then the previously mentioned filter would not run.
IFeatureFilterMetadata
With the introduction of IContextualFeatureFilter
there are now two types of feature filters including IFeatureFilter
. The two types of feature filters both inherit IFeatureFilterMetadata
. IFeatureFilterMetadata
is a marker interface and does not actually provide any feature filtering capabilities. It is used as the new parameter type for IFeatureManagementBuilder.AddFeatureFilter
.
Breaking Changes
IFeatureManager.IsEnabled
is now asynchronousIsEnabled
was renamed toIsEnabledAsync
.IFeatureManagerSnapshot.IsEnabled
is also affected.
IFeatureFilter.Evaluate
is now asynchronousEvaluate
was renamed toEvaluateAsync
.
Mvc.Filters.FilterCollection.AddForFeature
now only accepts
IAsyncActionFilter
rather than any type of filter.AddRouteForFeature
has been removed.ISessionManager
is now an async interface.
1.0.0-preview-009000001-1251
Added some missing commas in readme json. (#6)