Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveDunn committed Jun 14, 2021
1 parent 03d8643 commit 89de0f3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class BinderOptions
public bool BindNonPublicProperties { get; set; }

/// <summary>
/// When false (the default), no exceptios are thrown when a configuration key is found for which the
/// When false (the default), no exceptions are thrown when a configuration key is found for which the
/// provided model object does not have an appropriate property which matches the key's name.
/// When true, an <see cref="System.InvalidOperationException"/> is thrown with a description
/// of the missing properties.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ private static void BindNonScalar(this IConfiguration configuration, object inst
{
if (instance != null)
{
var modelProperties = GetAllProperties(instance.GetType()).ToList();
List<PropertyInfo> modelProperties = GetAllProperties(instance.GetType()).ToList();

if (options.ErrorOnUnknownConfiguration)
{
HashSet<string> propertyNames = new(modelProperties.Select(mp => mp.Name),
StringComparer.OrdinalIgnoreCase);

var missingPropertyNames = configuration.GetChildren()
List<string> missingPropertyNames = configuration.GetChildren()
.Where(cs => !propertyNames.Contains(cs.Key))
.Select(mp => $"'{mp.Key}'")
.ToList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,7 @@
<data name="Capacity_NotUsedEntirely" xml:space="preserve">
<value>Entire reserved capacity was not used. Capacity: '{0}', written '{1}'.</value>
</data>
<data name="Error_MissingConfig" xml:space="preserve">
<value>'{0}' was set on the provided {1}, but the following properties were not found on the instance of {2}: {3}</value>
</data>
</root>

0 comments on commit 89de0f3

Please sign in to comment.