ASP.NET Core middleware, minimal APIs, controllers, dependency injection, configuration, and Entity Framework Core migrations and queries.
41 cards · basic cards · AI-written, checked twice. Edit anything.
- What is ASP.NET Core middleware?
Show answer
Software components that process HTTP requests and responses in a pipeline.
- In what order does middleware execute?
Show answer
In the order registered in Program.cs, then returns in reverse order.
- What method registers custom middleware in the pipeline?
Show answer
UseMiddleware<T>(), called on IApplicationBuilder.
- What is a minimal API?
Show answer
An HTTP endpoint defined directly in Program.cs without a controller class.
- What does MapGet do?
Show answer
Registers an HTTP GET endpoint with a delegate that executes when the route is accessed.
- What does MapPost do?
Show answer
Registers an HTTP POST endpoint for handling resource creation.
- How do you extract a route parameter in a minimal API?
Show answer
Pass it as a parameter to the delegate with the same name as the route segment.
- How do you extract a query parameter in a minimal API?
Show answer
Pass it as a parameter to the delegate with the same name as the query key.
- What is dependency injection?
Show answer
A design pattern where objects receive dependencies from external sources rather than creating them.
- What are the three service lifetimes in ASP.NET Core DI?
Show answer
Transient, Scoped, and Singleton.
- When is a transient service created?
Show answer
Every time it is requested.
- When is a scoped service created?
Show answer
Once per HTTP request.
- When is a singleton service created?
Show answer
Once for the entire application lifetime.
- What method registers a transient service?
Show answer
AddTransient<IService, Service>()
- What method registers a scoped service?
Show answer
AddScoped<IService, Service>()