dotnet minimal api extension method for logic validation
Hey guys I have three if statements that are repeated too often in many endpoints, how can I make an extension method to use on my endpoints? here is the current code
and I want it to be something like:
Thanks!
3 Replies
Use a middleware or a filter?
Make an
IEndpointFilter
and use it on the endpoints that need it with .AddEndpointFilter<T>()
+1 for filters, seems like the best option here