All fields

“Controllers vs Minimal APIs” in Information Technology

41 questions across 2 technologies.

Information Technology

41 questions in 2 technologies

#QuestionTechnologyTopicLevel
1What features do controllers provide out of the box that minimal APIs don't have native equivalents for? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsIntermediate
2How does model binding work differently between controllers (using [FromBody], [FromQuery] attributes) and minimal APIs (using parameter inference)? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsIntermediate
3Can a single ASP.NET Core project use both controllers and minimal APIs simultaneously, and what are valid reasons to do so? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsIntermediate
4How does route-to-code discoverability differ between controllers' attribute-based routing and minimal APIs' explicit registration, and what are the trade-offs for large codebases? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsIntermediate
5How does the underlying request execution pipeline differ in performance between controllers and minimal APIs, and what accounts for the difference? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsAdvanced
6How would you decide between controllers and minimal APIs for a new project, weighing team familiarity, project complexity, and long-term maintainability? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsAdvanced
7How do you implement equivalent cross-cutting concerns (like automatic model validation) in minimal APIs that [ApiController] provides automatically for controllers? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsAdvanced
8How does dependency injection differ in practice between controllers (constructor injection) and minimal APIs (parameter injection)? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsAdvanced
9What is the fundamental structural difference between controller-based APIs (MVC) and minimal APIs in ASP.NET Core? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsBeginner
10What is ControllerBase, and why do API controllers typically inherit from it rather than the full Controller class? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsBeginner
11How do you apply the same authorization, CORS, and rate limiting policies consistently across both controllers and minimal API endpoints in a hybrid application? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsIntermediate
12How do action results like Ok(), NotFound(), and BadRequest() in controllers compare to their minimal API equivalents like Results.Ok() and TypedResults? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsIntermediate
13How would you migrate an existing controller-based API to minimal APIs incrementally without a risky big-bang rewrite? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsAdvanced
14How do you write integration tests that work consistently for both controller-based and minimal API endpoints using WebApplicationFactory? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsAdvanced
15How do you organize a large number of minimal API endpoints without ending up with an enormous, unwieldy Program.cs file? ASP.NET Core › Controllers vs Minimal APIsASP.NET CoreControllers vs Minimal APIsIntermediate
16How does IEndpointFilter provide similar cross-cutting functionality for minimal APIs that MVC filters provide for controllers? ASP.NET Core › FiltersASP.NET CoreFiltersIntermediate
17What are Minimal APIs in ASP.NET Core, and when would you choose them over traditional MVC controllers? .NET › ASP.NET Core Middleware & Request Pipeline.NETASP.NET Core Middleware & Request PipelineIntermediate
18How do you restrict access to a minimal API endpoint or endpoint group using authorization, given minimal APIs don't use controller attributes? ASP.NET Core › AuthorizationASP.NET CoreAuthorizationIntermediate
19How does minimal API content negotiation differ from the [ApiController]-based MVC approach, given minimal APIs return results via IResult? ASP.NET Core › Content Negotiation & Output FormattersASP.NET CoreContent Negotiation & Output FormattersIntermediate
20How do you apply different CORS policies to different controllers or minimal API endpoint groups within the same application? ASP.NET Core › CORS (Cross-Origin Resource Sharing)ASP.NET CoreCORS (Cross-Origin Resource Sharing)Advanced
21How do you implement URL segment-based API versioning for controllers using [ApiVersion] and route templates? ASP.NET Core › API VersioningASP.NET CoreAPI VersioningIntermediate
22How do you mix Blazor components with traditional MVC controllers and Razor Pages within the same ASP.NET Core application? ASP.NET Core › Blazor Integration with ASP.NET CoreASP.NET CoreBlazor Integration with ASP.NET CoreIntermediate
23What is route grouping via MapGroup, and how does it let you apply shared route prefixes, metadata, and filters to a set of related minimal API endpoints? ASP.NET Core › Endpoint Metadata, Route Constraints & TemplatesASP.NET CoreEndpoint Metadata, Route Constraints & TemplatesIntermediate
24How do you handle exceptions specifically within minimal API endpoints, given they don't use the traditional MVC exception filter pipeline? ASP.NET Core › Error HandlingASP.NET CoreError HandlingIntermediate
25How do you implement API versioning for minimal API endpoints, since they don't use controller attributes? ASP.NET Core › API VersioningASP.NET CoreAPI VersioningAdvanced
26How does dependency injection integrate with minimal API endpoint handlers versus controller constructors? ASP.NET Core › Dependency InjectionASP.NET CoreDependency InjectionAdvanced
27How would you unit test a service or minimal API handler that depends on multiple injected interfaces, without spinning up the full DI container? ASP.NET Core › Dependency InjectionASP.NET CoreDependency InjectionAdvanced
28What is OpenAPI, and how does Swashbuckle generate an OpenAPI document for an ASP.NET Core API? ASP.NET Core › API Documentation with Swagger/OpenAPIASP.NET CoreAPI Documentation with Swagger/OpenAPIBeginner
29What is a route template in ASP.NET Core, and how do route parameters like {id} work within one? ASP.NET Core › Endpoint Metadata, Route Constraints & TemplatesASP.NET CoreEndpoint Metadata, Route Constraints & TemplatesBeginner
30How do you add XML documentation comments to enrich generated Swagger documentation with descriptions? ASP.NET Core › API Documentation with Swagger/OpenAPIASP.NET CoreAPI Documentation with Swagger/OpenAPIIntermediate
31How do you version your OpenAPI documentation to reflect API versioning implemented via the Asp.Versioning library? ASP.NET Core › API Documentation with Swagger/OpenAPIASP.NET CoreAPI Documentation with Swagger/OpenAPIIntermediate
32What is the difference between versioning at the API level (entire controller/group) versus versioning individual actions within a shared controller? ASP.NET Core › API VersioningASP.NET CoreAPI VersioningIntermediate
33How do you unit test that a specific API version's controller action behaves correctly, given the version-based routing? ASP.NET Core › API VersioningASP.NET CoreAPI VersioningIntermediate
34What is the purpose of the [AllowAnonymous] attribute, and how does it interact with a controller-level [Authorize] attribute? ASP.NET Core › AuthorizationASP.NET CoreAuthorizationIntermediate
35How does the [Authorize] attribute interact with Razor Pages, given they don't use the traditional controller/action model? ASP.NET Core › AuthorizationASP.NET CoreAuthorizationIntermediate
36How does Blazor's routing system integrate with ASP.NET Core's endpoint routing, and can they coexist for the same URL space? ASP.NET Core › Blazor Integration with ASP.NET CoreASP.NET CoreBlazor Integration with ASP.NET CoreIntermediate
37How does route template precedence work when multiple routes could potentially match the same incoming URL? ASP.NET Core › Endpoint Metadata, Route Constraints & TemplatesASP.NET CoreEndpoint Metadata, Route Constraints & TemplatesIntermediate
38How do route parameter transformers let you customize the casing convention of generated URLs, such as converting PascalCase action names to kebab-case URLs? ASP.NET Core › Endpoint Metadata, Route Constraints & TemplatesASP.NET CoreEndpoint Metadata, Route Constraints & TemplatesIntermediate
39How does the newer built-in Microsoft.AspNetCore.OpenApi package (introduced in .NET 9) differ from the third-party Swashbuckle package? ASP.NET Core › API Documentation with Swagger/OpenAPIASP.NET CoreAPI Documentation with Swagger/OpenAPIAdvanced
40What is 'design-first' versus 'code-first' API development, and how does OpenAPI tooling support each approach? ASP.NET Core › API Documentation with Swagger/OpenAPIASP.NET CoreAPI Documentation with Swagger/OpenAPIAdvanced
41What are keyed services (introduced in .NET 8), and what problem do they solve compared to injecting IEnumerable<T> when you need one specific implementation? ASP.NET Core › Dependency InjectionASP.NET CoreDependency InjectionAdvanced