-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds 'Settings' to Context and uses it as a cache of parameters
- Loading branch information
1 parent
e79252b
commit 48d58a2
Showing
12 changed files
with
294 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
// | ||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.Primitives; | ||
|
||
namespace Microsoft.FeatureManagement | ||
{ | ||
/// <summary> | ||
/// Wraps an instance of IConfiguration. | ||
/// </summary> | ||
class ConfigurationWrapper : IConfiguration | ||
{ | ||
private readonly IConfiguration _configuration; | ||
|
||
public ConfigurationWrapper(IConfiguration configuration) | ||
{ | ||
_configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); | ||
} | ||
|
||
public string this[string key] | ||
{ | ||
get => _configuration[key]; | ||
set => _configuration[key] = value; | ||
} | ||
|
||
public IEnumerable<IConfigurationSection> GetChildren() => | ||
_configuration.GetChildren(); | ||
|
||
public IChangeToken GetReloadToken() => | ||
_configuration.GetReloadToken(); | ||
|
||
public IConfigurationSection GetSection(string key) => | ||
_configuration.GetSection(key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/Microsoft.FeatureManagement/FeatureFilters/IFilterParametersBinder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
// | ||
using Microsoft.Extensions.Configuration; | ||
|
||
namespace Microsoft.FeatureManagement | ||
{ | ||
/// <summary> | ||
/// An interface used by the feature management system to pre-bind feature filter parameters to a settings type. | ||
/// <see cref="IFeatureFilter"/>s can implement this interface to take advantage of caching of settings by the feature management system. | ||
/// </summary> | ||
public interface IFilterParametersBinder | ||
{ | ||
/// <summary> | ||
/// Binds a set of feature filter parameters to a settings object. | ||
/// </summary> | ||
/// <param name="parameters">The configuration representing filter parameters to bind to a settings object</param> | ||
/// <returns>A settings object that is understood by the implementer of <see cref="IFilterParametersBinder"/>.</returns> | ||
object BindParameters(IConfiguration parameters); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.