# SAIF.Platform.AspNetCore

Provides ASP.NET Core middleware and HTTP client extensions for propagating slot routing across service-to-service calls in PR slot deployments.

## Getting started

Register and use slot routing in your service:

```csharp
builder.Services.AddSlotRouting();

// ...

app.UseSlotRouting();
```

- `AddSlotRouting()` — registers `SlotRoutingMiddleware` and `SlotRoutingDelegatingHandler`, and wires the handler into `ConfigureHttpClientDefaults` so the `x-saif-slot-routing` value is forwarded on **all** outbound `HttpClient` requests (including calls to external services) when a slot is active.
- `UseSlotRouting()` — adds the middleware to the request pipeline. Must be called before endpoint middleware.

Services that already use `AddJwtBearerServices()` or `AddOpenIdConnectServices()` from `SAIF.Platform.Authentication.AspNetCore` do not need to call these explicitly — slot routing is registered automatically. See that package's [README](../SAIF.Platform.Authentication.AspNetCore/index.md#coupling-with-slot-routing) for the other direction of this coupling.

---

[View source on GitHub](https://github.com/saif-corp/forge/blob/main/src/dotnet/SAIF.Platform.AspNetCore/README.md)
