Skip to content

Restored processors registration that was broken in MediatR 12.1.0+#49

Merged
Anthony Simmon (asimmon) merged 1 commit intomainfrom
feature/idp-839-processor-hack
Jan 12, 2024
Merged

Restored processors registration that was broken in MediatR 12.1.0+#49
Anthony Simmon (asimmon) merged 1 commit intomainfrom
feature/idp-839-processor-hack

Conversation

@asimmon
Copy link
Copy Markdown
Contributor

Description of changes

Context

We planed to leverage MediatR pre and post processors to execute arbitrary code before and after requests are executed.
These processors used to be automatically registered. Developers didn't have to manually register them in the DI services.

In MediatR 12.1.0, the automatic registration was removed, and devs were forced to manually register them in the DI services.
In MediatR 12.2.0, the automatic registration was supposed to be brought back under an option that must be set to true (opt-in), but it's bugged.

More details in this opened PR: LuckyPennySoftware/MediatR#989 (comment)

Changes

  • Wrote a "hack" that calls the MediatR internal code to execute the pre/post registration as before. Basically has the same effect than the opened PR mentioned above.
  • Added tests to ensure that we always automatically register pre/post processors and the corresponding behavior.

Breaking changes

Now that we upgraded to MediatR 2.2.0, there are a few side-effects:

There's nothing we can do about that. There was no need for MediatR to do these upgrades. Usually third-parties dependencies like that are kept to a minimum version.

Additional checks

- [ ] Updated the documentation of the project to reflect the changes

  • Added new tests that cover the code changes

@asimmon Anthony Simmon (asimmon) requested a review from a team as a code owner January 11, 2024 18:39
@asimmon Anthony Simmon (asimmon) deleted the feature/idp-839-processor-hack branch January 17, 2024 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants