
Minimal APIs
Route handlers, parameter binding, filters, OpenAPI, route groups, performance
1What is a Minimal API in ASP.NET Core?
What is a Minimal API in ASP.NET Core?
Antwort
Minimal APIs are a simplified approach to creating HTTP APIs in ASP.NET Core, introduced with .NET 6. They allow defining endpoints directly in Program.cs without requiring controllers or complex configuration. This approach reduces boilerplate code and improves performance for simple to moderately complex APIs, while offering a more modern and functional development experience.
2Which method allows defining a GET endpoint in Minimal APIs?
Which method allows defining a GET endpoint in Minimal APIs?
Antwort
MapGet is the dedicated method for registering an HTTP GET endpoint in Minimal APIs. It takes as parameters the route pattern and a delegate that defines the processing logic. This method is part of the Map* method family which also includes MapPost, MapPut, MapDelete, and MapPatch for other HTTP verbs.
3How to bind a route parameter in a Minimal API endpoint?
How to bind a route parameter in a Minimal API endpoint?
Antwort
Route parameter binding in Minimal APIs is done automatically by naming convention. Simply define a parameter in the route pattern between curly braces, then declare a parameter with the same name in the handler signature. ASP.NET Core automatically performs the binding and type conversion. For example, for a pattern /users/{id}, an int id parameter will be automatically bound and converted.
What is the difference between Results and TypedResults in Minimal APIs?
How to inject a service into a Minimal API handler?
+15 Interview-Fragen
Weitere .NET-Interviewthemen
C# Basics
LINQ & Delegates
C# Language Essentials
ASP.NET Core Fundamentals
ASP.NET Core Request Lifecycle
Configuration & Settings
Application Lifecycle
Dependency Injection
Entity Framework Core
Web API Development
Async in ASP.NET Core
Authentication & Authorization
HttpClient & Networking
JSON Serialization
Entity Framework Core Advanced
C# Advanced Features
Clean Architecture
Logging, Monitoring & Observability
Unit Testing & xUnit
Integration Testing
Docker & Containerization
NuGet Package Management
Memory Management & GC
Reactive Programming
Async/await & Patterns
.NET Design Patterns
Performance Optimization
Security & Best Practices
SignalR & Real-time
Microservices Architecture
Meistere .NET für dein nächstes Interview
Zugang zu allen Fragen, Flashcards, technischen Tests, Code-Review-Übungen und Interview-Simulatoren.
Kostenlos starten