Fix for Issue 2206 (Register should specify Reuse.Transient explicitly.) #2207
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.
Description of Change
Describe your changes here.
Bugs Fixed
The current DryIoc adapter doesn't specify transient reuse scope parameters for registering type, and if containers default reuse rule is changed other than Transient, it doesn't correctly implement the target interfaces contracts.
Also automatic resolution of concrete type is also affected by container default reuse settings.
This is a fix for #2206
API Changes
None
Behavioral Changes
After this fix, the containerRegistry.Register call should register type as transient irrespective of the container's default reuse setting. Also. default automatic concrete type resolution always use transient, so any non registered type such as view models are always resolved as transient object.
Note that only with this fix, you can use DryIoc's MefAttribute extension out of the box as it will change the default reuse setting to Singleton.
PR Checklist