Skip to main content

.NET Core API and Database Workshop

About This Workshop

Design and build production-grade REST APIs using the most widely adopted enterprise framework — ASP.NET Core with .NET 8. Students learn to create APIs connected to real databases, implement authentication, and follow the same patterns used by development teams at leading companies worldwide.


What You'll Build

A fully functional Task Management REST API that:

  • Exposes CRUD endpoints for tasks and users
  • Connects to a SQL Server (or SQLite) database
  • Implements JWT-based authentication and authorization
  • Documents all endpoints with Swagger / OpenAPI
  • Follows the Repository Pattern for clean architecture

What You'll Learn

TopicDetails
ASP.NET Core BasicsProject structure, middleware pipeline, DI
REST API DesignHTTP methods, routing, status codes, best practices
Entity Framework CoreCode First, DbContext, models, migrations
Database IntegrationSQL Server Express / SQLite, CRUD with EF Core
JWT AuthenticationToken generation, claims, securing endpoints
Middleware & FiltersCustom middleware, global error handling
API DocumentationSwagger / OpenAPI integration
Best PracticesRepository pattern, dependency injection, configuration

Curriculum

Module 1 — .NET 8 and ASP.NET Core Introduction

  • The .NET ecosystem overview: what is .NET 8?
  • How ASP.NET Core differs from traditional ASP.NET
  • Creating a new Web API project with the .NET CLI
  • Understanding the project structure: Program.cs, appsettings.json
  • The middleware pipeline and request lifecycle
  • Dependency Injection (DI) built into ASP.NET Core

Module 2 — Building REST Endpoints

  • Controllers vs Minimal APIs: when to use each
  • HTTP methods: GET, POST, PUT, PATCH, DELETE
  • Route templates and route parameters
  • Action methods and return types (IActionResult, ActionResult<T>)
  • Model binding: reading data from body, route, and query string
  • HTTP status codes and when to return each
  • Input validation with Data Annotations

Module 3 — Entity Framework Core

  • What is an ORM and why use EF Core?
  • Code First approach: defining models as C# classes
  • Configuring the DbContext
  • Data annotations and Fluent API for schema configuration
  • One-to-many and many-to-many relationships
  • Running your first migration: Add-Migration and Update-Database
  • Querying data with LINQ and EF Core

Module 4 — Full CRUD with Database

  • Implementing GET all, GET by ID, POST, PUT, DELETE
  • Async/await patterns in controllers
  • Handling 404 Not Found and validation errors
  • DTOs (Data Transfer Objects): keeping API contracts clean
  • AutoMapper for mapping between models and DTOs

Module 5 — JWT Authentication & Authorization

  • Understanding authentication vs authorization
  • What is a JWT token? Header, payload, signature
  • Generating JWT tokens on login
  • Validating tokens in the middleware pipeline
  • Claims-based identity: roles and user-specific data
  • Protecting endpoints with [Authorize] attribute
  • Returning 401 Unauthorized and 403 Forbidden correctly

Module 6 — Middleware and Error Handling

  • Writing custom middleware
  • Global exception handling middleware
  • Structured logging with Microsoft.Extensions.Logging
  • Introduction to Serilog for production logging
  • Health check endpoints

Module 7 — API Documentation with Swagger

  • Adding Swashbuckle (Swagger) to ASP.NET Core
  • Auto-generating OpenAPI specs from controllers
  • Testing endpoints directly in Swagger UI
  • Adding JWT auth to Swagger UI for protected endpoints
  • XML documentation comments in controllers

Module 8 — Architecture & Best Practices

  • Repository Pattern: abstracting data access
  • Service Layer: separating business logic from controllers
  • Configuration management with appsettings and environment variables
  • Secrets management: never hardcode connection strings
  • Introduction to unit testing controllers with xUnit

Module 9 — Hands-on Project

  • Build the complete Task Management API end-to-end
  • Implement all CRUD endpoints with EF Core
  • Add JWT authentication
  • Document with Swagger
  • Code review, refactoring, and Q&A

Prerequisites

RequirementDetails
ProgrammingBasic C# knowledge (classes, methods, variables) helpful
ConceptsUnderstanding of HTTP and REST APIs (helpful)
DatabaseNo prior SQL or database experience required
DeviceLaptop with Windows 10/11 or macOS 12+
info

Students with no C# experience can still follow along — the first 30 minutes include a quick C# primer.


Workshop Format

Duration1 full day (6–8 hours)
FormatInstructor-led, hands-on coding
Group SizeUp to 30 students
DeliveryOn-site at your institute

Tools & Technologies

  • .NET 8 SDK — ASP.NET Core Web API
  • Entity Framework Core — ORM
  • SQL Server Express or SQLite — database
  • Postman — API testing
  • VS Code + C# Dev Kit, or Visual Studio 2022 Community
  • Swagger / OpenAPI — API documentation

Learning Outcomes

By the end of this workshop, students will be able to:

✅ Create an ASP.NET Core Web API project from scratch
✅ Design and implement RESTful endpoints following HTTP standards
✅ Connect to a relational database using Entity Framework Core
✅ Run database migrations and perform CRUD operations
✅ Implement JWT authentication and secure API endpoints
✅ Document APIs with Swagger UI
✅ Apply the Repository Pattern for clean, testable architecture