Skip to content

Commit 23be6f3

Browse files
committed
chore: update README.md to include example for hierarchical configuration data.
1 parent 3298e2a commit 23be6f3

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,35 @@ public class SampleLambda
144144
}
145145
```
146146

147+
# Hierarchical configuration data
148+
Let's assume we want to load configuration per the below class hierarchy:
149+
```csharp
150+
public class DemoConfig
151+
{
152+
public string TestItem { get; set; }
153+
public DemoSubConfig SubConfig { get; set; }
154+
}
155+
156+
public class DemoSubConfig
157+
{
158+
public string SubItem { get; set; }
159+
}
160+
```
161+
In System Manager parameter store, these hierarchical values could be represented with below names (notice the use of `/` delimiter):
162+
| Name | Type |
163+
| :-------- | :------- |
164+
| /my-application/Config/TestItem | String |
165+
| /my-application/Config/SubConfig/SubItem | String |
166+
167+
Using `WebApplicationBuilder` as an example, the above configuration hierarchy could be loaded using below code:
168+
```csharp
169+
var builder = WebApplication.CreateBuilder(args);
170+
171+
builder.Configuration.AddSystemsManager($"/my-application/");
172+
173+
builder.Services.Configure<DemoConfig>(builder.Configuration.GetSection("Config"));
174+
```
175+
147176
## Samples
148177

149178
### Custom ParameterProcessor Sample

0 commit comments

Comments
 (0)