Closed matthewrdev closed 4 years ago
@ravero Can you comment on this and let me know if this scaffolder and it's template makes sense for everyday use?
A few things I would adjust:
HttpGet
attribute already receives route data through the first argument (which is optional), so the Route
attribute is unnecessary. You can just write like:[HttpGet("$route$")]
ControllerBase
on API ControllersActionResult<T>
instead of IActionResult
. The T
can be of the type you will be returning and this will works better with the documentation generation libraries like Swashbuckle (there are a few examples of that in the CRM).Suggestion: as I understand the scaffolder as a tool for quickly creating useful files, a would add a few additional templates:
using System.Threading.Tasks;
[HttpGet, Route("$route$")]
public async Task<ActionResult> GetAsync()
{
// TODO: Implement
return Ok("Success");
}
Post
method instead of Get.This has been completed and will be available in MFrator v4.2.2
Criteria
Controller
.Template
Inputs:
$namespace$
: The project default namespace and folder path.$name$
: The name of the new controller.$route$
: The$name$
with theController
suffix removed.