Base Template — Architecture (agents)¶
Agent intent¶
Before moving any class between projects, decide: Domain ↔ Application ↔ Infrastructure ↔ ServiceModel. Wrong placement breaks architecture tests and reviewer trust.
Canonical narrative: Architecture — public
Mandatory rules¶
DomainModel— no references to EF/NH, ASP.NET, HTTP clients, IServiceProvider.ApplicationModel/Application— orchestration; depends on domain + abstractions.PersistenceModel.*— adapters; implements interfaces owned by application/domain.ServiceModel.*— transport; maps DTOs/commands to application layer.
Web host DI (three stacks)¶
| Order | Type | Agent notes |
|---|---|---|
| 1 | ApplicationModelRegistrationBase |
Shared packages—do not duplicate in product |
| 2 | MicroserviceRegistrationBase |
Kernel—patch in Base repo, not copy-paste |
| 3 | Template registration | Identity / Gateway / … only here |
MSBuild conditions¶
Optional features exclude whole directories at scaffold time. If an agent “does not see” Orleans/OpenAI files, check symbols in .template.config/template.json / build/*.props—do not re-add by hand without aligning symbols.
Anti-patterns (reject in codegen)¶
| Bad | Good |
|---|---|
Domain entity referencing HttpClient |
Application service + port interface |
Product-specific aggregate in ConnectSoft.BaseTemplate.DomainModel |
Layer 3 ConnectSoft.{Product}.DomainModel |
Duplicate Program.cs kernel in submodule only |
Upstream fix + submodule bump |