Open rikrak opened 1 year ago
Actually, having just reviewed this again in my codebase, I'm not sure I like the idea of multiple parameters. It makes the route intuitive, but it marginally complicates the construction of the command.
public override async Task<ActionResult> HandleAsync(CountryIdentifier id, CountryRenameRequest request, CancellationToken cancellationToken = new CancellationToken())
{
var cmd = _mapper.Map<CountryRenameCommand>(request);
cmd = cmd with {Id = id};
RunCommand(cmd);
// ...
}
instead of
public override async Task<ActionResult> HandleAsync(CountryRenameRequest request, CancellationToken cancellationToken = new CancellationToken())
{
var cmd = _mapper.Map<CountryRenameCommand>(request);
RunCommand(cmd);
// ...
}
Not sure if this is currently possible, but I've been trying to create a POST endpoint where part of the parameters come from the route. I can't get it to work with a single request parameter as the entire class is bound to the requets body.
For example, I'd like to be able to support scenarios like:
This doen't seem to be currently possible if I use the
EndpointBasAsync.WithRequest<T>.WithResponse
mechanism for declaring the endpoint.I've worked around it by re-creating the
EndpointBaseAsync
structure and adapting it. Is this an appropriate thing to do, or is there a better way to achieve the same thing?happy to submit a PR for this sort of thing :-)