Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order of execution of RequestPreProcessorBehavior changed with explicit processor registration? #996

Closed
PTAdvanced opened this issue Jan 29, 2024 · 2 comments
Labels

Comments

@PTAdvanced
Copy link

Hi Jimmy and all

I'm just catching up and updating from 12.1 to 12.2. I knew the explicit processor registration changes had been made, and needed to do some refactoring here.

I've got all my Pre/Post processors being explicitly registered on startup when calling AddMediatr(). Also have a nice little test in place which flags up any IPreProcessors that have not been explicitly registered.

However, I noticed I have some issues in scenarios where I have PipelineBehaviours for cross cutting concerns, particularly authorisation checks.

I have an AuthCheckBehaviour which was always explicitly registered. With Mediatr 12.1 my Behaviours would execute first, and then any pre-processors if they exist for the TRequest. In 12.2 it looks like the RequestPreProcessorBehavior is handling the request first, before my AuthBehaviour.

I can see looking at the commits for #922 that the RequestPreProcessorBehavior and RequestPostProcessorBehavior are now being registered before the serviceConfiguration.BehaviorsToRegister are being registered.

Could I just double check if that is correct, and also is there a way that I can configure my pipeline so that my Authorisation behaviour is called before the RequestPreProcessorBehavior? I tried to explicitly register the RequestPreProcessorBehavior in .AddMediatr() after my behaviours, but that didn't work.

Many thanks

Paul

Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale label Mar 30, 2024
Copy link

This issue was closed because it has been stalled for 14 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant