Added Decorate() method to KernalBase #169
Open
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.
Hi guys,
Firstly I'm relatively new to Ninject so I don't pretent to understand all of the functionality. Also a big thanks to everyone who has contributed to this project :-)
When I started using it one thing I really wanted was to be able to easily decorate a registered type with another type, so I could pass the decorated type into the constructor of the decorator. I know I can achieve this, but the examples I've seen require the decorator to be declared with the class it is decorating. I wanted to simply apply each class one on top of the next in a pipeline, in quite a loosely coupled way, but specifically without the decorator knowing the concrete class it is decorating.
With the code I've added I can now do this like so:
Given the code below
I'm not sure if this would be of any use to the community (if not perhaps it can be adapted slightly?), but I wanted to share just in case.
Thanks