When should I use IPipelineBehavior over IRequestPreProcessor? What's the core difference? #732
-
Hi, I have a bunch of custom So my question is when would I want to use public class AuthenticationBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : IAuthenticatedRequest to this: public class AuthenticationPreProcessor<TRequest> : IRequestPreProcessor<TRequest> where TRequest : IAuthenticatedRequest what would be the practical difference? I do see that the preprocessor doesn't return a response, but besides that, is there anything else that would be significantly different? Are there any benefits which I'm not seeing other than just cognitively knowing that this is supposed to process the request only and that it can't short circuit and return before even entering a handler? When should one approach be favored over the other? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's not significantly different - it's just to be explicit that "this runs before the handler" and "this runs after the handler", so you don't have to worry about the delegate to execute the continuation. Sometimes that delegate confuses people. |
Beta Was this translation helpful? Give feedback.
It's not significantly different - it's just to be explicit that "this runs before the handler" and "this runs after the handler", so you don't have to worry about the delegate to execute the continuation. Sometimes that delegate confuses people.