Anyone using Ardalis ApiEndpoints? Have a question

Controller is a controller.

It just has “ISender mediator” injected into it as the sole dependency

I would like to get to a point when I can add the standard controller attributes to the command/query, and then have source generators create the controllers.

Next problem I fought with was hybrid binding so that I could bind a RequestDto.Id to the route and the rest to the body.
There is actually so much to put in place for a big project to increase developer cadence and establish low-code patterns...
 
Next problem I fought with was hybrid binding so that I could bind a RequestDto.Id to the route and the rest to the body.
There is actually so much to put in place for a big project to increase developer cadence and establish low-code patterns...
Hahah. I have been think about this EXACT issue right now.

I think that I have had an epiphany…
But I need to explore it a bit before going into detail.
But essentially I am thinking “why can’t this be more RPC style, instead of REST”
 
Hahah. I have been think about this EXACT issue right now.

I think that I have had an epiphany…
But I need to explore it a bit before going into detail.
But essentially I am thinking “why can’t this be more RPC style, instead of REST”
Actually got it working. Pretty nifty that you can still use a single object as a request for your endpoint method whether controller or mediatr and the values are sourced from route and or body and or query
 
Actually got it working. Pretty nifty that you can still use a single object as a request for your endpoint method whether controller or mediatr and the values are sourced from route and or body and or query
So you mean if you have
Code:
GET /users/{id}
public ActionResult GetUser(Query query)
And “query” has an “id” property it works?

If so that is awesome
 
So you mean if you have
Code:
GET /users/{id}
public ActionResult GetUser(Query query)
And “query” has an “id” property it works?

If so that is awesome
Yep or Command. I can share you you want it...
 
Yep or Command. I can share you you want it...

That is great to know. Never thought to try it like that.

Will give this a go later.
Interested to see what happens if you include an ID in the url AND in the body for a POST, which takes precedence
 
That is great to know. Never thought to try it like that.

Will give this a go later.
Interested to see what happens if you include an ID in the url AND in the body for a POST, which takes precedence
I tried it now. It populates from the URL even if you populate Id in the body. One would expect it because the Id property in the request has the [FromRoute] attribute and the rest of the properties nothing, which in the new ASP Net Core defaults to [FromBody]
 
I tried it now. It populates from the URL even if you populate Id in the body. One would expect it because the Id property in the request has the [FromRoute] attribute and the rest of the properties nothing, which in the new ASP Net Core defaults to [FromBody]
Ahh, so you still need to add the [FromRoute] - that makes sense, and isn’t a huge deal
 
Only thing I can't yet get right is the CreatedAt result. Wonder if because I am using one controller class per endpoint and the Mvc cannot figure out the GET route even when I name it
 
Top
Sign up to the MyBroadband newsletter
X