Action naming (ARCH802)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key dotnet.api.action-naming · Severity info · Category api
API action names should represent the resource rather than repeat the HTTP verb. Consistent RESTful naming makes the API predictable.
Incorrect
Section titled “Incorrect”[HttpGet]public IActionResult GetAllUsersList() => Ok(_service.All());
[HttpPost]public IActionResult DoCreateUser(CreateUserRequest request) => Ok();Correct
Section titled “Correct”[HttpGet]public IActionResult List() => Ok(_service.All());
[HttpPost]public IActionResult Create(CreateUserRequest request) => Ok();Rename actions to be resource-focused and consistent, without repeating the action already implied by the HTTP verb.