Skip to content

Commit 89f15c9

Browse files
authored
Merge branch 'master' into fix/automapper-security-upgrade
2 parents f0b39b1 + 125a9a9 commit 89f15c9

2 files changed

Lines changed: 64 additions & 36 deletions

File tree

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,5 @@ Example: `feat(api): add player search endpoint (#123)`
118118
feat(scope): description (#issue)
119119
120120
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
121+
Co-authored-by: Claude <noreply@anthropic.com>
121122
```

README.md

Lines changed: 63 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Proof of Concept for a RESTful API built with .NET 10 (LTS) and ASP.NET Core. Ma
4444
## Tech Stack
4545

4646
| Category | Technology |
47-
|----------|------------|
47+
| -------- | ---------- |
4848
| **Framework** | [.NET 10](https://github.com/dotnet/core) (LTS) |
4949
| **Web Framework** | [ASP.NET Core 10.0](https://github.com/dotnet/aspnetcore) |
5050
| **API Documentation** | [Swashbuckle](https://github.com/domaindrivendev/Swashbuckle.AspNetCore) (OpenAPI 3.0) |
@@ -95,7 +95,7 @@ test/Dotnet.Samples.AspNetCore.WebApi.Tests/
9595

9696
## Architecture
9797

98-
Dependencies flow from data layer through repositories and services to controllers. External dependencies (AutoMapper, FluentValidation, Serilog, Swashbuckle) integrate at their respective layers.
98+
Layered architecture with dependency injection via constructors and interface-based contracts.
9999

100100
```mermaid
101101
@@ -112,11 +112,19 @@ Dependencies flow from data layer through repositories and services to controlle
112112
113113
graph RL
114114
115-
Models[Models]
115+
Tests[Tests]
116116
117-
subgraph Layer4[" "]
118-
Data[Data]
119-
Repositories[Repositories]
117+
subgraph Layer1[" "]
118+
Program[Program]
119+
Serilog[Serilog]
120+
Swashbuckle[Swashbuckle]
121+
end
122+
123+
subgraph Layer2[" "]
124+
Controllers[Controllers]
125+
Validators[Validators]
126+
FluentValidation[FluentValidation]
127+
AspNetCore[ASP.NET Core]
120128
end
121129
122130
subgraph Layer3[" "]
@@ -126,44 +134,43 @@ graph RL
126134
MemoryCache[MemoryCache]
127135
end
128136
129-
subgraph Layer2[" "]
130-
Controllers[Controllers]
131-
Validators[Validators]
132-
FluentValidation[FluentValidation]
133-
Swashbuckle[Swashbuckle]
137+
subgraph Layer4[" "]
138+
Repositories[Repositories]
139+
Data[Data]
140+
EFCore[EF Core]
134141
end
135142
136-
subgraph Layer1[" "]
137-
Program[Program]
138-
Configurations[Configurations]
139-
Serilog[Serilog]
140-
end
143+
Models[Models]
141144
142-
Tests[Tests]
145+
%% Strong dependencies
143146
144-
%% Application flow
145-
Data --> Models
146-
Models --> Repositories
147-
Repositories --> Services
148-
Services --> Controllers
147+
%% Layer 1
149148
Controllers --> Program
149+
Serilog --> Program
150+
Swashbuckle --> Program
150151
151-
%% Layer connections
152-
Models --> Mappings
152+
%% Layer 2
153+
Services --> Controllers
153154
Validators --> Controllers
154-
Mappings --> Services
155-
156-
%% External Dependencies connections
157-
AutoMapper --> Mappings
158155
FluentValidation --> Validators
159-
Serilog --> Program
160-
Swashbuckle --> Controllers
156+
AspNetCore --> Controllers
161157
162-
%% Supporting Features connections
163-
Configurations --> Program
158+
%% Layer 3
159+
Repositories --> Services
164160
MemoryCache --> Services
161+
Mappings --> Services
162+
AutoMapper --> Mappings
163+
Models --> Mappings
164+
165+
%% Layer 4
166+
Models --> Repositories
167+
Models --> Data
168+
Data --> Repositories
169+
EFCore --> Data
170+
EFCore -.-> Repositories
171+
172+
%% Soft dependencies
165173
166-
%% Tests connections
167174
Services -.-> Tests
168175
Controllers -.-> Tests
169176
@@ -176,10 +183,30 @@ graph RL
176183
class Data,Models,Repositories,Services,Controllers,Program,Validators,Mappings core;
177184
class AutoMapper,FluentValidation,Serilog,Swashbuckle deps;
178185
class Tests test;
179-
class Configurations,MemoryCache feat;
186+
class AspNetCore,EFCore,MemoryCache feat;
180187
```
181188

182-
*Layered architecture: Core application flow (blue), supporting features (yellow), external dependencies (red), and test coverage (green). Not all dependencies are shown.*
189+
### Arrow Semantics
190+
191+
Arrows point from a dependency toward its consumer. Solid arrows (`-->`) denote **strong (functional) dependencies**: the consumer actively invokes behavior — registering types with the IoC container, executing queries, applying mappings, or handling HTTP requests. Dotted arrows (`-.->`) denote **soft (structural) dependencies**: the consumer only references types or interfaces without invoking runtime behavior. This distinction follows UML's `«use»` dependency notation and classical coupling theory (Myers, 1978): strong arrows approximate *control or stamp coupling*, while soft arrows approximate *data coupling*, where only shared data structures cross the boundary.
192+
193+
### Composition Root Pattern
194+
195+
The `Program` module acts as the composition root — it is the sole site where dependencies are registered with the IoC container, wired via interfaces, and resolved at runtime by the ASP.NET Core host. Rather than explicit object construction, .NET relies on built-in dependency injection: `Program` registers services, repositories, DbContext, mappers, validators, and middleware, and the framework instantiates them on demand. This pattern enables dependency injection, improves testability, and ensures no other module bears responsibility for type registration or lifecycle management.
196+
197+
### Layered Architecture
198+
199+
The codebase is organized into four conceptual layers: Initialization (`Program`), HTTP (`Controllers`, `Validators`), Business (`Services`, `Mappings`), and Data (`Repositories`, `Data`).
200+
201+
Framework packages and third-party dependencies are co-resident within the layer that consumes them: `Serilog` and `Swashbuckle` inside Initialization, `ASP.NET Core` and `FluentValidation` inside HTTP, `AutoMapper` inside Business, and `EF Core` inside Data. `ASP.NET Core`, `EF Core`, and `MemoryCache` are Microsoft platform packages (yellow); `AutoMapper`, `FluentValidation`, `Serilog`, and `Swashbuckle` are third-party packages (red).
202+
203+
The `Models` package is a **cross-cutting type concern** — it defines shared entities and DTOs consumed across multiple layers via strong dependencies, without containing logic or behavior of its own. Dependencies always flow from consumers toward their lower-level types: each layer depends on (consumes) the layers below it, and no layer invokes behavior in a layer above it.
204+
205+
### Color Coding
206+
207+
Core packages (blue) implement the application logic, supporting features (yellow) are Microsoft platform packages, third-party dependencies (red) are community packages, and tests (green) ensure code quality.
208+
209+
*Simplified, conceptual view — not all components or dependencies are shown.*
183210

184211
## API Reference
185212

@@ -387,7 +414,7 @@ STORAGE_PATH=/storage/players-sqlite3.db
387414
## Command Summary
388415

389416
| Command | Description |
390-
|---------|-------------|
417+
| ------- | ----------- |
391418
| `dotnet watch run --project src/...` | Start development server with hot reload |
392419
| `dotnet build` | Build the solution |
393420
| `dotnet test` | Run all tests |

0 commit comments

Comments
 (0)