1. Introduction to REST APIs and .NET 10
Introduction to REST APIs and .NET 10
1.1 Introduction to REST APIs and .NET 10
- REST Principles: Resource-based URLs, stateless communication, standard HTTP methods
- What’s New in .NET 10: Performance improvements, new minimal APIs enhancements, built-in rate limiting improvements
- Why .NET for APIs: Cross-platform, high performance, mature ecosystem
- Learning Path Overview: From basic CRUD to production-ready APIs
1.2 Installing .NET 10 SDK and Tooling
- Download and install .NET 10 SDK
- Verify installation: dotnet –version
- IDE options: Visual Studio 2025, VS Code, Rider
- Essential extensions: C# Dev Kit, REST Client, Docker
1.3 Creating the Initial Web API Project
dotnet new webapi -n CommandAPI
cd CommandAPI
dotnet run
- Understanding the default template
- Project file structure walkthrough
- Code Segment: Examining CommandAPI.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>
1.4 Understanding Program.cs (Minimal Hosting Model)
- Evolution: From Startup.cs to minimal APIs
- Program.cs anatomy:
var builder = WebApplication.CreateBuilder(args);
// Service registration happens here
builder.Services.AddControllers();
var app = builder.Build();
// Middleware pipeline configured here
app.MapControllers();
app.Run();
- Key Concepts:
- WebApplicationBuilder - constructs the host
- Service container - dependency injection setup
- Middleware pipeline - request processing chain
- Teaching Point: Show how this replaced the old Program.cs + Startup.cs pattern
1.5 Introduction to the Sample Domain
- Domain Context: Command-line reference application
- Core Entities:
- Platform: Represents OS/environment (Windows, Linux, Docker)
- Command: Specific command-line instruction for a platform
- Real-world Analogy: Like a cookbook (Platforms) with recipes (Commands)
- Business Rules:
- One Platform has many Commands
- Every Command must belong to a Platform
- Commands are user-specific