Table of Contents

Controllers

The framework adds routing conventions and helper behavior on top of ASP.NET MVC.

Features

  • Auto-routing: controllers are routed automatically based on class name and namespace
  • BaseApiController: adds JSON and XML response helpers for API actions
  • Action matching: overload resolution prefers the action whose parameters best match the request values
  • Short route aliases: names such as PokemonApiController resolve to both long and short route variants

Behavior

Controllers inheriting from Controller or BaseApiController are discovered automatically by the framework. The routing conventions apply without requiring [Route] attributes on every controller.

API endpoints are built under /api/ and follow the controller/action pattern. Namespace segments beyond the root are included in the route path when present.

MyApp.Api.Admin.UserApiController -> /api/admin/userapi/ and /api/admin/user/

The auto-routing logic prefers the action whose parameter names best match the incoming query string values when multiple actions could match the same request.

BaseApiController exposes convenience response helpers such as Json(object data, bool camelCase = true) and Xml(object data).

Caveats

  • Controllers with explicit [Route] attributes are excluded from the framework’s automatic convention behavior.
  • Controllers marked with [ApiController] are also excluded from the auto-routing pattern.
  • The framework does not replace the ASP.NET routing system; it adds a convention layer and friendly action selection behavior.
Tip

Inherit BaseApiController for API endpoints when you want the framework to handle response shaping and route conventions for you.