AutoActions for Skinny controllers- templating-part2
Now I want to add templates to my controller generators . But this feature changed the whole perspective about the project. Why ? Because a template do not apply just to a field – but to the whole controller. So instead of having attributes on the field
[AutoActions]
private readonly RepositoryWF repository;
I will have attributes on the controller
[AutoActions(template = TemplateIndicator.AllPost,FieldsName =new[] { “repository” })]
[ApiController]
[Route(“[controller]/[action]”)]
public partial class WeatherForecastController : ControllerBase
I was thinking out about this modification. It is better , because now we can see also the route – if the routing is not well, the actions are not working ( if it is not a pure REST , then the route must have [action])
The code- oh, the code. It is a mostly complete refactoring of the code . The fact that I have organized into methods – processClass, processFields have make the pain less … but anyway – you will find the modifications here: https://github.com/ignatandrei/AOP_With_Roslyn/commit/eba37f0c7b1aadb56e40b52af57afedc9925eb5a .
And SCRIBAN performed well – no big problems. I have just made a template that makes the actions POST, named AllPost.
Deployed also on NuGet
Leave a Reply