diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/ref/Microsoft.Extensions.Configuration.Binder.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/ref/Microsoft.Extensions.Configuration.Binder.cs index 4d3c63896503b..3f7008b2aae0e 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/ref/Microsoft.Extensions.Configuration.Binder.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/ref/Microsoft.Extensions.Configuration.Binder.cs @@ -16,6 +16,9 @@ public static partial class ConfigurationBinder public static void Bind(this Microsoft.Extensions.Configuration.IConfiguration configuration, object instance) { } public static void Bind(this Microsoft.Extensions.Configuration.IConfiguration configuration, object instance, System.Action configureOptions) { } public static void Bind(this Microsoft.Extensions.Configuration.IConfiguration configuration, string key, object instance) { } + public static void Bind(this Microsoft.Extensions.Configuration.IConfiguration configuration, string key, T instance) { } + public static void Bind(this Microsoft.Extensions.Configuration.IConfiguration configuration, T instance) { } + public static void Bind(this Microsoft.Extensions.Configuration.IConfiguration configuration, T instance, System.Action configureOptions) { } public static object Get(this Microsoft.Extensions.Configuration.IConfiguration configuration, System.Type type) { throw null; } public static object Get(this Microsoft.Extensions.Configuration.IConfiguration configuration, System.Type type, System.Action configureOptions) { throw null; } public static object GetValue(this Microsoft.Extensions.Configuration.IConfiguration configuration, System.Type type, string key) { throw null; } diff --git a/src/libraries/Microsoft.Extensions.Configuration.Binder/src/ConfigurationBinder.cs b/src/libraries/Microsoft.Extensions.Configuration.Binder/src/ConfigurationBinder.cs index 171a8dfa69de3..4c521ff1b67ff 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Binder/src/ConfigurationBinder.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Binder/src/ConfigurationBinder.cs @@ -81,6 +81,24 @@ public static object Get(this IConfiguration configuration, Type type, Action + /// TODO add + /// + public static void Bind(this IConfiguration configuration, string key, T instance) + => configuration.GetSection(key).Bind(instance); + + /// + /// TODO add + /// + public static void Bind(this IConfiguration configuration, T instance) + => configuration.Bind(instance, o => { }); + + /// + /// TODO add + /// + public static void Bind(this IConfiguration configuration, T instance, Action configureOptions) + => configuration.Bind((object)instance, configureOptions); + /// /// Attempts to bind the given object instance to the configuration section specified by the key by matching property names against configuration keys recursively. ///