Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Commit 37c3070

Browse files
committed
Added doc-comments for main API
- Coherence-Signed#75
1 parent dbdaf4e commit 37c3070

File tree

8 files changed

+132
-19
lines changed

8 files changed

+132
-19
lines changed

src/Microsoft.Extensions.Configuration.Abstractions/IConfiguration.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,33 @@
66

77
namespace Microsoft.Extensions.Configuration
88
{
9+
/// <summary>
10+
/// Represents a set of key/value application configuration properties.
11+
/// </summary>
912
public interface IConfiguration
1013
{
14+
/// <summary>
15+
/// Gets or sets a configuration value.
16+
/// </summary>
17+
/// <param name="key">The configuration key.</param>
18+
/// <returns>The configuration value.</returns>
1119
string this[string key] { get; set; }
1220

21+
/// <summary>
22+
/// Gets a configuration sub-section with the specified key.
23+
/// </summary>
24+
/// <param name="key">The key of the configuration section.</param>
25+
/// <returns>The <see cref="IConfigurationSection"/>.</returns>
26+
/// <remarks>
27+
/// This method will never return <c>null</c>. If no matching sub-section is found with the specified key,
28+
/// an empty <see cref="IConfigurationSection"/> will be returned.
29+
/// </remarks>
1330
IConfigurationSection GetSection(string key);
1431

32+
/// <summary>
33+
/// Gets the immediate descendant configuration sub-sections.
34+
/// </summary>
35+
/// <returns>The configuration sub-sections.</returns>
1536
IEnumerable<IConfigurationSection> GetChildren();
1637

1738
IChangeToken GetReloadToken();

src/Microsoft.Extensions.Configuration.Abstractions/IConfigurationBuilder.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,34 @@
55

66
namespace Microsoft.Extensions.Configuration
77
{
8+
/// <summary>
9+
/// Represents a type used to build application configuration.
10+
/// </summary>
811
public interface IConfigurationBuilder
912
{
13+
/// <summary>
14+
/// Gets a key/value collection that can be used to share data between the <see cref="IConfigurationBuilder"/>
15+
/// and the registered <see cref="IConfigurationProvider"/>s.
16+
/// </summary>
1017
Dictionary<string, object> Properties { get; }
1118

19+
/// <summary>
20+
/// Gets the providers used to obtain configuation values
21+
/// </summary>
1222
IEnumerable<IConfigurationProvider> Providers { get; }
1323

24+
/// <summary>
25+
/// Adds a new configuration provider.
26+
/// </summary>
27+
/// <param name="provider">The configuration provider to add.</param>
28+
/// <returns>The same <see cref="IConfigurationBuilder"/>.</returns>
1429
IConfigurationBuilder Add(IConfigurationProvider provider);
1530

31+
/// <summary>
32+
/// Builds an <see cref="IConfiguration"/> with keys and values from the set of providers registered in
33+
/// <see cref="Providers"/>.
34+
/// </summary>
35+
/// <returns>An <see cref="IConfigurationRoot"/> with keys and values from the registered providers.</returns>
1636
IConfigurationRoot Build();
1737
}
1838
}

src/Microsoft.Extensions.Configuration.Abstractions/IConfigurationProvider.cs

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,40 @@
55

66
namespace Microsoft.Extensions.Configuration
77
{
8+
/// <summary>
9+
/// Represents a source of configuration key/values for an application.
10+
/// </summary>
811
public interface IConfigurationProvider
912
{
13+
/// <summary>
14+
/// Tries to get a configuration value for the specified key.
15+
/// </summary>
16+
/// <param name="key">The key.</param>
17+
/// <param name="value">The value.</param>
18+
/// <returns><c>True</c> if a value for the specified key was found, otherwise <c>false</c>.</returns>
1019
bool TryGet(string key, out string value);
1120

21+
/// <summary>
22+
/// Sets a configuration value for the specified key.
23+
/// </summary>
24+
/// <param name="key">The key.</param>
25+
/// <param name="value">The value.</param>
1226
void Set(string key, string value);
1327

28+
/// <summary>
29+
/// Loads configuration values from the source represented by this <see cref="IConfigurationProvider"/>.
30+
/// </summary>
1431
void Load();
1532

16-
IEnumerable<string> GetChildKeys(
17-
IEnumerable<string> earlierKeys,
18-
string parentPath,
19-
string delimiter);
33+
/// <summary>
34+
/// Returns the immediate descendant configuration keys for a given parent path based on this
35+
/// <see cref="IConfigurationProvider"/>'s data and the set of keys returned by all the preceding
36+
/// <see cref="IConfigurationProvider"/>s.
37+
/// </summary>
38+
/// <param name="earlierKeys">The child keys returned by the preceding providers for the same parent path.</param>
39+
/// <param name="parentPath">The parent path.</param>
40+
/// <param name="delimiter">The delimiter to use to identify keys in the <see cref="IConfigurationProvider"/>'s data.</param>
41+
/// <returns>The child keys.</returns>
42+
IEnumerable<string> GetChildKeys(IEnumerable<string> earlierKeys, string parentPath, string delimiter);
2043
}
2144
}

src/Microsoft.Extensions.Configuration.Abstractions/IConfigurationRoot.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@
33

44
namespace Microsoft.Extensions.Configuration
55
{
6+
/// <summary>
7+
/// Represents the root of an <see cref="IConfiguration"/> hierarchy.
8+
/// </summary>
69
public interface IConfigurationRoot : IConfiguration
710
{
11+
/// <summary>
12+
/// Force the configuration values to be reloaded from the underlying <see cref="IConfigurationProvider"/>s.
13+
/// </summary>
814
void Reload();
915
}
1016
}
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
54
namespace Microsoft.Extensions.Configuration
65
{
6+
/// <summary>
7+
/// Represents a section of application configuration values.
8+
/// </summary>
79
public interface IConfigurationSection : IConfiguration
810
{
11+
/// <summary>
12+
/// Gets the key this section occupies in its parent.
13+
/// </summary>
914
string Key { get; }
15+
16+
/// <summary>
17+
/// Gets the full path to this section within the <see cref="IConfiguration"/>.
18+
/// </summary>
1019
string Path { get; }
20+
21+
/// <summary>
22+
/// Gets or sets the section value.
23+
/// </summary>
1124
string Value { get; set; }
1225
}
1326
}

src/Microsoft.Extensions.Configuration.EnvironmentVariables/EnvironmentVariablesExtensions.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,29 @@
55

66
namespace Microsoft.Extensions.Configuration
77
{
8+
/// <summary>
9+
/// Extension methods for registering <see cref="EnvironmentVariablesConfigurationProvider"/> with <see cref="IConfigurationBuilder"/>.
10+
/// </summary>
811
public static class EnvironmentVariablesExtensions
912
{
13+
/// <summary>
14+
/// Adds an <see cref="IConfigurationProvider"/> that reads configuration values from environment variables.
15+
/// </summary>
16+
/// <param name="configurationBuilder">The <see cref="IConfigurationBuilder"/> to add to.</param>
17+
/// <returns>The <see cref="IConfigurationBuilder"/>.</returns>
1018
public static IConfigurationBuilder AddEnvironmentVariables(this IConfigurationBuilder configurationBuilder)
1119
{
1220
configurationBuilder.Add(new EnvironmentVariablesConfigurationProvider());
1321
return configurationBuilder;
1422
}
1523

24+
/// <summary>
25+
/// Adds an <see cref="IConfigurationProvider"/> that reads configuration values from environment variables
26+
/// with a specified prefix.
27+
/// </summary>
28+
/// <param name="configurationBuilder">The <see cref="IConfigurationBuilder"/> to add to.</param>
29+
/// <param name="prefix">The prefix that environment variable names must start with.</param>
30+
/// <returns>The <see cref="IConfigurationBuilder"/>.</returns>
1631
public static IConfigurationBuilder AddEnvironmentVariables(
1732
this IConfigurationBuilder configurationBuilder,
1833
string prefix)

src/Microsoft.Extensions.Configuration.FileExtensions/FileConfigurationExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ namespace Microsoft.Extensions.Configuration
88
public static class FileConfigurationExtensions
99
{
1010
/// <summary>
11-
/// Sets the base path in <see cref="IConfigurationBuilder"/> for file based providers.
11+
/// Sets the base path to discover files in for file-based providers.
1212
/// </summary>
1313
/// <param name="configurationBuilder">The <see cref="IConfigurationBuilder"/> to add to.</param>
14-
/// <param name="basePath">Absolute path of file based providers.
14+
/// <param name="basePath">The absolute path of file-based providers.</param>
1515
/// <returns>The <see cref="IConfigurationBuilder"/>.</returns>
1616
public static IConfigurationBuilder SetBasePath(this IConfigurationBuilder configurationBuilder, string basePath)
1717
{
@@ -31,7 +31,7 @@ public static IConfigurationBuilder SetBasePath(this IConfigurationBuilder confi
3131
}
3232

3333
/// <summary>
34-
/// Gets the base path in <see cref="IConfigurationBuilder"/> for file based providers.
34+
/// Gets the base path to discover files in for file-based providers.
3535
/// </summary>
3636
/// <param name="configurationBuilder">The <see cref="IConfigurationBuilder"/> to add to.</param>
3737
/// <returns>The <see cref="IConfigurationBuilder"/>.</returns>

src/Microsoft.Extensions.Configuration/ConfigurationBuilder.cs

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@
55

66
namespace Microsoft.Extensions.Configuration
77
{
8+
/// <summary>
9+
/// Used to build key/value based configuration settings for use in an application.
10+
/// </summary>
811
public class ConfigurationBuilder : IConfigurationBuilder
912
{
1013
private readonly IList<IConfigurationProvider> _providers = new List<IConfigurationProvider>();
1114

15+
/// <summary>
16+
/// Returns the providers used to obtain configuation values.
17+
/// </summary>
1218
public IEnumerable<IConfigurationProvider> Providers
1319
{
1420
get
@@ -17,36 +23,45 @@ public IEnumerable<IConfigurationProvider> Providers
1723
}
1824
}
1925

26+
/// <summary>
27+
/// Gets a key/value collection that can be used to share data between the <see cref="IConfigurationBuilder"/>
28+
/// and the registered <see cref="IConfigurationProvider"/>s.
29+
/// </summary>
2030
public Dictionary<string, object> Properties { get; } = new Dictionary<string, object>();
2131

2232
/// <summary>
2333
/// Adds a new configuration provider.
2434
/// </summary>
25-
/// <param name="configurationProvider">The configuration provider to add.</param>
26-
/// <returns>The same configuration provider.</returns>
27-
public IConfigurationBuilder Add(IConfigurationProvider configurationProvider)
35+
/// <param name="provider">The configuration provider to add.</param>
36+
/// <returns>The same <see cref="IConfigurationBuilder"/>.</returns>
37+
public IConfigurationBuilder Add(IConfigurationProvider provider)
2838
{
29-
return Add(configurationProvider, load: true);
39+
return Add(provider, load: true);
3040
}
3141

3242
/// <summary>
33-
/// Adds a new configuration provider.
43+
/// Adds a new provider to obtain configuration values from.
44+
/// This method is intended only for test scenarios.
3445
/// </summary>
35-
/// <param name="configurationProvider">The configuration provider to add.</param>
46+
/// <param name="provider">The configuration provider to add.</param>
3647
/// <param name="load">If true, the configuration provider's <see cref="IConfigurationProvider.Load"/> method will
3748
/// be called.</param>
38-
/// <returns>The same configuration provider.</returns>
39-
/// <remarks>This method is intended only for test scenarios.</remarks>
40-
public IConfigurationBuilder Add(IConfigurationProvider configurationProvider, bool load)
49+
/// <returns>The same <see cref="IConfigurationBuilder"/>.</returns>
50+
public IConfigurationBuilder Add(IConfigurationProvider provider, bool load)
4151
{
4252
if (load)
4353
{
44-
configurationProvider.Load();
54+
provider.Load();
4555
}
46-
_providers.Add(configurationProvider);
56+
_providers.Add(provider);
4757
return this;
4858
}
4959

60+
/// <summary>
61+
/// Builds an <see cref="IConfiguration"/> with keys and values from the set of providers registered in
62+
/// <see cref="Providers"/>.
63+
/// </summary>
64+
/// <returns>An <see cref="IConfigurationRoot"/> with keys and values from the registered providers.</returns>
5065
public IConfigurationRoot Build()
5166
{
5267
return new ConfigurationRoot(_providers);

0 commit comments

Comments
 (0)