Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Microsoft.FeatureManagement/FeatureManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public async Task<bool> IsEnabledAsync<TContext>(string feature, TContext appCon
/// <param name="feature">The name of the feature to check.</param>
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
/// <returns>True if the feature is enabled, otherwise false.</returns>
public async ValueTask<bool> IsEnabledAsync(string feature, CancellationToken cancellationToken)
public async ValueTask<bool> IsEnabledAsync(string feature, CancellationToken cancellationToken = default)
{
EvaluationEvent evaluationEvent = await EvaluateFeature<object>(feature, context: null, useContext: false, cancellationToken);

Expand All @@ -183,7 +183,7 @@ public async ValueTask<bool> IsEnabledAsync(string feature, CancellationToken ca
/// <param name="appContext">A context providing information that can be used to evaluate whether a feature should be on or off.</param>
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
/// <returns>True if the feature is enabled, otherwise false.</returns>
public async ValueTask<bool> IsEnabledAsync<TContext>(string feature, TContext appContext, CancellationToken cancellationToken)
public async ValueTask<bool> IsEnabledAsync<TContext>(string feature, TContext appContext, CancellationToken cancellationToken = default)
{
EvaluationEvent evaluationEvent = await EvaluateFeature(feature, context: appContext, useContext: true, cancellationToken);

Expand All @@ -203,7 +203,7 @@ public IAsyncEnumerable<string> GetFeatureNamesAsync()
/// Retrieves a list of feature names registered in the feature manager.
/// </summary>
/// <returns>An enumerator which provides asynchronous iteration over the feature names registered in the feature manager.</returns>
public async IAsyncEnumerable<string> GetFeatureNamesAsync([EnumeratorCancellation] CancellationToken cancellationToken)
public async IAsyncEnumerable<string> GetFeatureNamesAsync([EnumeratorCancellation] CancellationToken cancellationToken = default)
{
await foreach (FeatureDefinition featureDefinition in _featureDefinitionProvider.GetAllFeatureDefinitionsAsync().ConfigureAwait(false))
{
Expand All @@ -219,7 +219,7 @@ public async IAsyncEnumerable<string> GetFeatureNamesAsync([EnumeratorCancellati
/// <param name="feature">The name of the feature to evaluate.</param>
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
/// <returns>A variant assigned to the user based on the feature's configured allocation.</returns>
public async ValueTask<Variant> GetVariantAsync(string feature, CancellationToken cancellationToken)
public async ValueTask<Variant> GetVariantAsync(string feature, CancellationToken cancellationToken = default)
{
if (string.IsNullOrEmpty(feature))
{
Expand All @@ -238,7 +238,7 @@ public async ValueTask<Variant> GetVariantAsync(string feature, CancellationToke
/// <param name="context">An instance of <see cref="TargetingContext"/> used to evaluate which variant the user will be assigned.</param>
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
/// <returns>A variant assigned to the user based on the feature's configured allocation.</returns>
public async ValueTask<Variant> GetVariantAsync(string feature, TargetingContext context, CancellationToken cancellationToken)
public async ValueTask<Variant> GetVariantAsync(string feature, TargetingContext context, CancellationToken cancellationToken = default)
{
if (string.IsNullOrEmpty(feature))
{
Expand Down
10 changes: 5 additions & 5 deletions src/Microsoft.FeatureManagement/IVariantFeatureManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ public interface IVariantFeatureManager
/// </summary>
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
/// <returns>An enumerator which provides asynchronous iteration over the feature names registered in the feature manager.</returns>
IAsyncEnumerable<string> GetFeatureNamesAsync(CancellationToken cancellationToken);
IAsyncEnumerable<string> GetFeatureNamesAsync(CancellationToken cancellationToken = default);

/// <summary>
/// Checks whether a given feature is enabled.
/// </summary>
/// <param name="feature">The name of the feature to check.</param>
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
/// <returns>True if the feature is enabled, otherwise false.</returns>
ValueTask<bool> IsEnabledAsync(string feature, CancellationToken cancellationToken);
ValueTask<bool> IsEnabledAsync(string feature, CancellationToken cancellationToken = default);

/// <summary>
/// Checks whether a given feature is enabled.
Expand All @@ -35,15 +35,15 @@ public interface IVariantFeatureManager
/// <param name="context">A context providing information that can be used to evaluate whether a feature should be on or off.</param>
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
/// <returns>True if the feature is enabled, otherwise false.</returns>
ValueTask<bool> IsEnabledAsync<TContext>(string feature, TContext context, CancellationToken cancellationToken);
ValueTask<bool> IsEnabledAsync<TContext>(string feature, TContext context, CancellationToken cancellationToken = default);

/// <summary>
/// Gets the assigned variant for a specific feature.
/// </summary>
/// <param name="feature">The name of the feature to evaluate.</param>
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
/// <returns>A variant assigned to the user based on the feature's configured allocation.</returns>
ValueTask<Variant> GetVariantAsync(string feature, CancellationToken cancellationToken);
ValueTask<Variant> GetVariantAsync(string feature, CancellationToken cancellationToken = default);

/// <summary>
/// Gets the assigned variant for a specific feature.
Expand All @@ -52,6 +52,6 @@ public interface IVariantFeatureManager
/// <param name="context">An instance of <see cref="TargetingContext"/> used to evaluate which variant the user will be assigned.</param>
/// <param name="cancellationToken">The cancellation token to cancel the operation.</param>
/// <returns>A variant assigned to the user based on the feature's configured allocation.</returns>
ValueTask<Variant> GetVariantAsync(string feature, TargetingContext context, CancellationToken cancellationToken);
ValueTask<Variant> GetVariantAsync(string feature, TargetingContext context, CancellationToken cancellationToken = default);
}
}