Skip to content

Commit 41767d6

Browse files
committed
Add .NET Aspire configuration section with architecture and service defaults
1 parent 022e720 commit 41767d6

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

slides/Slides.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,88 @@ logger.LogInformation("Database timeout: {Timeout}s",
956956

957957
---
958958

959+
# .NET Aspire
960+
961+
---
962+
963+
# .NET Aspire Configuration
964+
965+
## Cloud-Native Configuration Made Simple
966+
967+
- **Orchestration**: Centralized service management through AppHost
968+
- **Service Defaults**: Opinionated baseline for observability, health checks, and service discovery
969+
- **Configuration Layering**: Hierarchical configuration across distributed services
970+
- **Modern Patterns**: Built-in support for microservices and cloud-native apps
971+
972+
---
973+
974+
# Aspire Configuration Architecture
975+
976+
<div class="columns">
977+
<div>
978+
979+
## AppHost Project
980+
981+
```csharp
982+
var builder = DistributedApplication.CreateBuilder(args);
983+
984+
var apiService = builder.AddProject<Projects.ApiService>("apiservice");
985+
986+
var workerService = builder.AddProject<Projects.WorkerService>("workerservice")
987+
.WithEnvironment("Api:BaseUrl", apiService.GetEndpoint("https"));
988+
989+
builder.Build().Run();
990+
```
991+
992+
</div>
993+
<div>
994+
995+
## Service Defaults
996+
997+
```csharp
998+
public static class Extensions
999+
{
1000+
public static IHostApplicationBuilder AddServiceDefaults(this IHostApplicationBuilder builder)
1001+
{
1002+
builder.ConfigureOpenTelemetry();
1003+
builder.AddDefaultHealthChecks();
1004+
builder.Services.AddServiceDiscovery();
1005+
1006+
builder.Services.ConfigureHttpClientDefaults(http =>
1007+
{
1008+
http.AddStandardResilienceHandler();
1009+
http.UseServiceDiscovery();
1010+
});
1011+
1012+
return builder;
1013+
}
1014+
}
1015+
```
1016+
1017+
</div>
1018+
</div>
1019+
1020+
---
1021+
1022+
# Aspire Configuration Layering
1023+
1024+
## Configuration Priority (Last Wins)
1025+
1026+
1. **SharedConfig** `appsettings.json` - Cross-service shared settings
1027+
2. **Service-specific** `appsettings.json` - Per-service configuration
1028+
3. **Environment-specific** `appsettings.{Environment}.json`
1029+
4. **User Secrets** (Development only)
1030+
5. **AppHost Environment Variables** - `WithEnvironment()` calls
1031+
6. **Command Line Parameters** - Runtime overrides
1032+
1033+
```csharp
1034+
// AppHost parameter injection
1035+
var apiService = builder.AddProject<Projects.ApiService>("apiservice")
1036+
.WithEnvironment("Api:InjectedMessage", builder.AddParameter("ApiBaseMessage"));
1037+
```
1038+
1039+
---
1040+
9591041
# Questions?
9601042

9611043
---
@@ -972,6 +1054,7 @@ logger.LogInformation("Database timeout: {Timeout}s",
9721054
### Docs
9731055

9741056
- [.NET Configuration Docs](https://learn.microsoft.com/en-us/dotnet/core/extensions/configuration)
1057+
- [.NET Aspire Docs](https://learn.microsoft.com/en-us/dotnet/aspire/)
9751058

9761059
</div>
9771060

0 commit comments

Comments
 (0)