Skip to content

Commit 2aebd5b

Browse files
committed
docs(multitenancy-aspnetcore): clarify middleware ordering
Note that auto wiring is intended for host/header resolution and manual ordering is required for route/claim and exception handling.
1 parent 123f51f commit 2aebd5b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/CleanArchitecture.Extensions.Multitenancy.AspNetCore/DependencyInjectionExtensions.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ public static class DependencyInjectionExtensions
2424
/// <param name="services">Service collection.</param>
2525
/// <param name="configureCore">Optional callback to configure <see cref="MultitenancyOptions"/>.</param>
2626
/// <param name="configureAspNetCore">Optional callback to configure <see cref="AspNetCoreMultitenancyOptions"/>.</param>
27-
/// <param name="autoUseMiddleware">Whether to add the multitenancy middleware automatically.</param>
27+
/// <param name="autoUseMiddleware">
28+
/// Whether to add the multitenancy middleware automatically. Use only for host/header resolution.
29+
/// Route/claim resolution requires manual ordering after routing/authentication.
30+
/// </param>
2831
public static IServiceCollection AddCleanArchitectureMultitenancyAspNetCore(
2932
this IServiceCollection services,
3033
Action<MultitenancyOptions>? configureCore = null,

src/CleanArchitecture.Extensions.Multitenancy.AspNetCore/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ using CleanArchitecture.Extensions.Multitenancy.AspNetCore;
2828
builder.Services.AddCleanArchitectureMultitenancyAspNetCore(autoUseMiddleware: true);
2929
```
3030

31-
Use `autoUseMiddleware` when header or host resolution is enough. For claim- or route-based resolution, disable it and place `app.UseCleanArchitectureMultitenancy()` after authentication or routing.
31+
Use `autoUseMiddleware` when header or host resolution is enough and you do not depend on route values. For claim- or route-based resolution, disable it and place `app.UseCleanArchitectureMultitenancy()` after authentication or routing. If you want tenant resolution exceptions to flow through your global exception handler, place it after `app.UseExceptionHandler(...)`.
3232

3333
### 2) Add the middleware (manual)
3434

0 commit comments

Comments
 (0)