I need to replace the EPiServer.Mail.Core.Sites.SiteHandler class with my own implementation, or somehow else change the logic of the CurrentSite property (which is virtual so I can override it in a derived class). However, I can't find any better way to plub in the instance of my own class than to set its singleton Instance property (which is public get/set). That works fine, unless for example some other code has attached an event handler to any of the instances events before I replace it... Currently there is no such code in the framework itself, so I can solve this in my code by using different IInitializableModule implementations with dependencies ensuring their execution order. But everything feels very impure... Any other ideas how this could be done?
I need to replace the EPiServer.Mail.Core.Sites.SiteHandler class with my own implementation, or somehow else change the logic of the CurrentSite property (which is virtual so I can override it in a derived class). However, I can't find any better way to plub in the instance of my own class than to set its singleton Instance property (which is public get/set). That works fine, unless for example some other code has attached an event handler to any of the instances events before I replace it... Currently there is no such code in the framework itself, so I can solve this in my code by using different IInitializableModule implementations with dependencies ensuring their execution order. But everything feels very impure... Any other ideas how this could be done?