How kiewic/aspnet-webapi-sample works
Project Type and Purpose
• This is an ASP.NET MVC + Web API sample application.
• Purpose: Demonstrate a CRUD REST interface (“Persons” resource) alongside a minimal MVC front-end.
• Key use cases: HTTP POST/GET/PUT/DELETE against /api/persons; simple HTML view at root.
File Structure
• Top-level solution (.sln) contains one ASP.NET WebAPI project under WebApiSample/WebApiSample.
• App_Start folder holds pipeline configuration: WebApiConfig (API routes), RouteConfig (MVC routes), BundleConfig (static assets), FilterConfig (global filters).
• Controllers split into MVC (HomeController → views) and Web API (PersonsController, ValuesController).
• Models folder holds domain entities (Person.cs).
• Config files: Web.config variants (Debug/Release) and ConnectionStrings.config.example hint at a backend data store.
• No explicit Data Access Layer folder—controllers likely call EF or in-memory store directly.
README
• Describes CRUD operations via curl against the /api/persons endpoint.
• No mention of advanced components (caching, messaging).
• Demonstrates usage, but not persistence details (you assume a relational DB).
Main Components and Their Relationships
a. Clients
– Web browser (MVC view)
– Any HTTP client (curl, Postman, mobile apps) calling REST endpoints
b. Web Server & Runtime
– IIS / Kestrel hosting the .NET Framework application
– ASP.NET pipeline with registered modules (bundles, filters)
c. MVC Layer
– HomeController → Views (Index.cshtml)
– Bundled scripts/CSS delivered to browser
d. Web API Layer
– PersonsController (CRUD)
– ValuesController (demo)
– Models (Person)
e. Data Store (external)
– SQL Server (or any ADO/EF-backed store) configured via ConnectionStrings.config
f. Configuration & Build
– App_Start, Web.configs, packages.config for NuGet dependencies
– Clients (left)
– Web Server (center) subdivided into MVC and Web API modules
– Data Store (right)
– HTTP requests from Clients → MVC routes or API routes
– Controllers → Data Store via ADO/ORM
– Data Store → Controllers → Clients (HTTP responses)
Architectural Patterns & Design Principles
• MVC for server-side rendering of the “Home” view.
• RESTful pattern for /api/persons (stateless interactions, HTTP verbs).
• Use of global filters (e.g., exception handling, authorization).
• Bundling/minification for static assets.
• Configuration per-environment (Debug vs. Release Web.config transforms).
Essential Details
– Show BundleConfig linking JS/CSS to MVC Module.
– Highlight WebApiConfig registering attribute- and convention-based routes.
– Show ConnectionStrings.config feeding the Data Access path.
– Note the presence of Web.Debug.config/Web.Release.config as environment overlays.