You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicclassMyEndpoint:Endpoint<MyRequest,MyResponse>{privateISender_mediator;publicMyEndpoint(ISendermediator){_mediator=mediator;}publicoverridevoidConfigure(){Post("/api/user/create");AllowAnonymous();}publicoverrideasyncTaskHandleAsync(MyRequestreq,CancellationTokenct){Response=await_mediator.Send(req,ct);}publicclassHandler(ISomeServicesomeService):IRequestHandler<MyRequest,MyResponse>{publicasyncTask<MyResponse>Handle(MyRequestrequest,CancellationTokenct){// Do stuffreturnnewMyResponse();}}}
This is a contrived example of course as you could have your validation in here, mappings etc.
Counter point, the MediatR author has mentioned that there's no need to use both libraries (as covered here) which I don't personally agree with given the MediatR pipeline gives you a middleware that works with any .NET project eg Razor, Console, Azure Funcs, Lambdas etc. and has always been the most useful part of the library IMO.
The text was updated successfully, but these errors were encountered:
Would greatly simplify the endpoint registration boilerplate (e.g. https://github.com/mehdihadeli/vertical-slice-api-template/blob/main/src/App/Vertical.Slice.Template/Products/Features/CreatingProduct/v1/CreateProductEndpoint.cs).
It's also built on top of minimal APIs and has built in support for other tools e.g. FluentValidation.
This is a contrived example of course as you could have your validation in here, mappings etc.
Counter point, the MediatR author has mentioned that there's no need to use both libraries (as covered here) which I don't personally agree with given the MediatR pipeline gives you a middleware that works with any .NET project eg Razor, Console, Azure Funcs, Lambdas etc. and has always been the most useful part of the library IMO.
The text was updated successfully, but these errors were encountered: