/// <summary> /// Bind the values to the given configuration /// </summary> /// <param name="binder">The binder.</param> /// <param name="objectType"></param> /// <param name="configuration">The configuration.</param> /// <param name="serializer">The serializer.</param> public static object Bind([NotNull] this IJsonBinder binder, Type objectType, IConfiguration configuration, JsonSerializer serializer) { if (binder == null) { throw new ArgumentNullException(nameof(binder)); } return(binder.Bind(objectType, GetValues(configuration), serializer)); }
/// <summary> /// Populate the values from the given configuration object /// </summary> /// <typeparam name="T"></typeparam> /// <param name="binder">The binder.</param> /// <param name="value">The value.</param> /// <param name="configuration">The configuration.</param> public static T Populate <T>([NotNull] this IJsonBinder binder, T value, IConfiguration configuration) where T : class { if (binder == null) { throw new ArgumentNullException(nameof(binder)); } return(binder.Populate(value, GetValues(configuration))); }
/// <summary> /// Bind the values to the given configuration /// </summary> /// <typeparam name="T"></typeparam> /// <param name="binder">The binder.</param> /// <param name="configuration">The configuration.</param> /// <param name="serializer">The serializer.</param> public static T Bind <T>([NotNull] this IJsonBinder binder, IConfiguration configuration, JsonSerializer serializer) where T : class, new() { if (binder == null) { throw new ArgumentNullException(nameof(binder)); } return(binder.Bind <T>(GetValues(configuration), serializer)); }