If you are new to dI.Hook, please visit the di.Hook Product Page for Overview, Release Version and Source Code.
Some posts you might want to read would be:
- How to create a HookRepository?
- How to add hooks to HookRepository?
- How to add hooks via configuration file to a HookRepository?
- How to invoke all hooks using dI.Hook?
- How to invoke hooks that satisfy a condition?
- How to retrieve an object of hook?
So this is the seventh article in the series which will deal with removing one or more hook objects from the repository.
Step 1 – Creating a repository and add hooks into a repository
The first decision in creating a hook repository is to think whether you want to have lazy loading or not. Once you have decided you can go through the steps – Creating a Hook Repository using dI.Hook
Be selective in adding hooks into a repository if you plan to invoke all of them at one go. If you are thinking of manually adding hooks to a repository, would suggest going through – Adding hooks manually into a repository. However, if you are planning to load them through configuration you can read – Loading a configuration set of hooks into repository
Step 2- How to remove an instance of a hook from a repository?
When we are referring to adding an instance of a hook in a repository, there are multiple ways of doing it
Method 1 – Removing hook instance( s ) at a time
Method 2 – Removing a List of hooks
Method 3 – Removing hooks of a particular type
Method 4 – Removing all hooks
So there are 4 ways to remove a hook from the repository so that any method using OnInvoke method on the repository will find the removed hook in the repository