The key reason you shouldn't do this is that you start COM lifecycle management in an instance of an object that it does not need. Now, .NET will have to do some COM interaction, which includes a stack of security stacks, streaming checks on apartments, and addref / release materials.
Instead, I would consider looking for dependencies (inverse of the control pattern) and the shared services locator pattern. I would focus on understanding constructor injection, as it is the preferred template for dependency management.
Here is what I do in my libraries. Let's say I want to write a logging service (a far-fetched example). I would have two main components:
MyStuff.Logging.Contracts - Here I have to declare the ILogger interface MyStuff.Logging - this is where I will write the different logging implementations that FileLogger, DatabaseLogger, etc. may have.
Then in my application, I would use either Ninject or Unity (DI containers) to bind ILogger to the default implementation.
Geoff cox
source share