Base Template — Architecture¶
Clean Architecture shape¶
The kernel follows onion / Clean Architecture with explicit project boundaries:
| Ring | Typical projects (ConnectSoft.BaseTemplate.*) |
Depends on |
|---|---|---|
| Domain | DomainModel |
Core only |
| Application | ApplicationModel, Application |
Domain, abstractions |
| Infrastructure | PersistenceModel.*, MessagingModel, ActorModel.*, … |
Application contracts, vendors |
| Presentation / host | Host (ConnectSoft.BaseTemplate or product Application), ServiceModel.* |
Composes all |
Enforcement: architecture / dependency tests in the solution validate that domain does not reference infrastructure or ASP.NET primitives. See Testing.
Prefixed project graph¶
ConnectSoft uses a prefixed layout—not generic src/Domain folders. Expect names such as:
ConnectSoft.BaseTemplate— web host (when REST/gRPC surfaces are enabled).ConnectSoft.BaseTemplate.DomainModel,ApplicationModel,ApplicationConnectSoft.BaseTemplate.PersistenceModel.*— NHibernate, MongoDB, etc., when selectedConnectSoft.BaseTemplate.ServiceModel.RestApi,.Grpc,.SignalR, … — conditional*Tests,*AcceptanceTests, architecture test projects
Layer 3 mirrors this with ConnectSoft.{Product}.* alongside ConnectSoft.BaseTemplate.* from the submodule.
Web host dependency injection (Layer 3 consumers)¶
For ASP.NET Core extended templates, service registration is composed in three layers:
ApplicationModelRegistrationBase(NuGet / shared packages) — application-model and cross-cutting registration shared across templates.MicroserviceRegistrationBase(submodule Base) — kernel pipeline: health, common middleware, baseline options.- Template-specific registration (e.g. Identity, Gateway,
HealthChecksAggregatorRegistration) — product endpoints, policies, and integrations.
sequenceDiagram
participant Host
participant AppModel as ApplicationModelRegistrationBase
participant Base as MicroserviceRegistrationBase
participant Prod as Template registration
Host->>AppModel: Add shared application model
Host->>Base: Add kernel microservice services
Host->>Prod: Add template-specific services
See BaseTemplate DI extensibility for extension points (partial methods, overrides).
MSBuild conditional composition¶
Optional stacks (Orleans, HangFire, OpenAI, vector stores, …) are included via Condition on <ProjectReference> and symbols in build/*.props. The dotnet new template excludes directories when symbols are false—generated solutions stay smaller and compile faster.
Authoritative symbol list: .template.config/template.json (sources.modifiers + symbols).
Layer 2 vs Layer 3 boundaries¶
- Base stays domain-agnostic: sample aggregates/features may exist for demos, not product bounded contexts.
- Layer 3 introduces product domain, replaces or extends the Application host, and ships OAuth, BFF, or aggregation behavior as appropriate.
Related¶
- Features — what can be turned on
- Parameters — scaffold symbols
- Solution structure — filesystem map
- Template layering and reuse