-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add Support For Generic Handlers With Multiple Generic Type Parameters #1048
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hisuwh
suggested changes
Jul 8, 2024
… for the request does not have a defined closed implementation / registration.
- created a feature flag that enables a user to opt out of registering generic handlers they have defined. - created a test that ensures that, when the flag is set, the generic handlers defined are not registered.
jbogard
approved these changes
Jul 16, 2024
oskogstad
referenced
this pull request
in digdir/dialogporten
Jul 31, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [MediatR](https://togithub.com/jbogard/MediatR) | `12.3.0` -> `12.4.0` | [![age](https://developer.mend.io/api/mc/badges/age/nuget/MediatR/12.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/nuget/MediatR/12.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/nuget/MediatR/12.3.0/12.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/MediatR/12.3.0/12.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>jbogard/MediatR (MediatR)</summary> ### [`v12.4.0`](https://togithub.com/jbogard/MediatR/releases/tag/v12.4.0) #### What's Changed - Add Support For Generic Handlers With Multiple Generic Type Parameters by [@​zachpainter77](https://togithub.com/zachpainter77) in [https://github.com/jbogard/MediatR/pull/1048](https://togithub.com/jbogard/MediatR/pull/1048) **Full Changelog**: jbogard/MediatR@v12.3.0...v12.4.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 7am on Sunday,before 7am on Wednesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View the [repository job log](https://developer.mend.io/github/digdir/dialogporten). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for handlers that contain multiple generic type parameters.
This PR is a direct fix for issues #1047 and #1038
Example:
The issue that this PR solves was caused from only attempting to close the first type parameter in a generic request handler implementation.
This PR fixes that by finding the types that close for all type parameter and storing those in a list of lists. Then all possible combinations of concrete implementations are generated from the lists and registered with the service provider.
Something that might need some discussion and thought will be what kinds of limitations we should put around this feature so that users are not misusing the library and creating a deadlock during service registration.
Along with this PR I added these configuration options with default values to the Configuraton object..
For now these are the default values, but I would like some feedback regarding these values.
I've also added some pretty extensive test methods that confirm this is working as expected.
@jbogard , @hisuwh Please review this at your convenience.
Thanks,
Edit: I apologize for not getting this done sooner.. I have just started a new job and haven't had the time. :)
Edit: Added an opt out functionality.