# `dotnet-enterprise` preset

> Primary .NET backend foundation. Phase 4 fills in the actual source under `templates/`.

## What you get

- **Clean Architecture solution** at `dotnet/`:
  - `Api/` — ASP.NET Core Web API (controllers, middleware, DI composition)
  - `Application/` — CQRS handlers (MediatR), validators (FluentValidation), DTOs
  - `Domain/` — entities, value objects, domain events (zero external deps)
  - `Infrastructure/` — EF Core (Postgres + SQL Server), JWT, SignalR, storage, email
  - `Shared/` — `ApiResponse<T>`, `Result`, `Error`, paging/sorting/filter params
- **Auth:** JWT + refresh-token rotation, Argon2id, MFA-ready scaffolding
- **AuthZ:** RBAC + policy-based; attribute-based-ready
- **Cross-cutting middleware:**
  - `ExceptionMiddleware` (RFC 7807 ProblemDetails)
  - `RequestLoggingMiddleware`
  - `CorrelationIdMiddleware`
- **Observability:** Serilog → OTLP, health checks (`/health`, `/health/ready`, `/health/live`), metrics endpoint
- **OpenAPI/Swagger** live in development
- **EF reads** standardized on `AsNoTracking() + .Select()` projection directly to response DTOs

## When it applies

- `extends` contains `dotnet-enterprise`, **and**
- `backend.primary === "dotnet"`

## Composes with

| Preset               | Notes                                                                 |
| -------------------- | --------------------------------------------------------------------- |
| `portal-platform`    | Adds portal controllers and domain entities                           |
| `angular-enterprise` | Frontend consumes API; contracts shared via `packages/api-contracts/` |
| `nestjs-enterprise`  | Runs alongside as a secondary API host (e.g. for BullMQ workers)      |

## Phase mapping

- Phase 2 (this phase): preset manifest + README
- Phase 4: full source materialization (`dotnet/`), Swagger live, seeded admin works
