Skip to content

Commit

Permalink
Update CompositeConfigurationSource.cs
Browse files Browse the repository at this point in the history
add jsonconfiguration source to composite
  • Loading branch information
chojomok committed Jan 6, 2025
1 parent 5b9d960 commit 7eb44b9
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public CompositeConfigurationSource(IEnumerable<IConfigurationSource> sources)
_sources = [..sources];
}

private string JsonConfigurationSource { get; set; } = "N/A, from composite configuration source";

/// <summary>
/// Adds a new configuration source to this instance.
/// </summary>
Expand All @@ -44,6 +46,10 @@ public void Add(IConfigurationSource source)
if (source == null) { ThrowHelper.ThrowArgumentNullException(nameof(source)); }

_sources.Add(source);
if (source is JsonConfigurationSource)
{
JsonConfigurationSource = source.ToString();
}
}

/// <summary>
Expand All @@ -58,6 +64,11 @@ public void Insert(int index, IConfigurationSource item)
_sources.Insert(index, item);
}

public override string ToString()
{
return JsonConfigurationSource;
}

/// <inheritdoc />
IEnumerator<IConfigurationSource> IEnumerable<IConfigurationSource>.GetEnumerator() => _sources.GetEnumerator();

Expand Down

0 comments on commit 7eb44b9

Please sign in to comment.