views:

9

answers:

1

Hi !

Suppose the .NET Component Model.

The Container class has GetService(Type service);

But I'm asking myself, how can I register Global Services accessible to all added Components ?

+1  A: 

In order to do this you'll need to create a class that derives from Container. The class Container only supports service for the GetService call and that's IContainer. There is no way to extend this except for sub-typing and overriding the GetService method.

However this is only of very limited value as the method GetService is protected. This means it's not usable by general components as they don't have access to this member.

JaredPar