How picolo21/iwantapp works
Project type and purpose
• This is a .NET 7+ minimal‐API service (C#) focused on managing “Categories” and “Products.”
• It follows a Clean/Onion Architecture style, separating Domain, Endpoints (presentation), and Infrastructure (data access).
File structure to define components
Top-level folders and roles:
• Domain: business entities & logic (Category.cs, Product.cs, Entity.cs)
• Endpoints: Minimal API endpoint definitions (CategoryGetAll, CategoryPost, etc.)
• Infra/Data: EF Core DbContext (ApplicationDbContext) & Migrations
• Program.cs + appsettings*.json: application bootstrap & configuration
Main architectural components
a. Client(s) (e.g., browser SPA, mobile app, Postman)
b. API Host (ASP.NET Core minimal API)
– Program.cs
– Endpoints/Categories/*.cs
c. Domain Layer
– Domain/Products: Category, Product, Entity base types
d. Infrastructure Layer
– Infra/Data/ApplicationDbContext
– Migrations (schema management)
e. Database
– Relational store (SQL Server or configured provider)
Optional external services (none in current code) can be added later.
Relationships and interactions
• Clients issue HTTP calls (GET, POST, PUT, DELETE) to the API Host.
• Program.cs wires each endpoint to its handler (e.g., CategoryGetAll → uses ApplicationDbContext).
• Endpoint handlers map CategoryRequest ↔ CategoryResponse via Domain entities.
• Handlers call ApplicationDbContext (EF Core) to read/write Category/Product tables.
• Migrations ensure the database schema matches the Domain model.
Architectural patterns & design principles
• Onion / Clean Architecture:
– Outermost: Endpoints (presentation)
– Middle: Domain entities (business logic, no external dependencies)
– Outermost infra adapter: EF Core DbContext, migrations
• Single‐responsibility endpoints (one file per CRUD).
• Minimal API style: functional endpoint definitions, no MVC controllers class overhead.
• Configuration via appsettings.json and launchSettings.json.