views:

23

answers:

1

Is is possible to get the container instance back from ServiceLocation? I only see the ability to resolve instances of types, not register them.

A: 

You can't. CommonServiceLocator only abstracts resolution, not registration. One of the reasons is that registration is wildly different for each particular container.

As Krzysztof commented, try to avoid service locator as much as possible. It might be necessary for some special cases to resolve something, but never to register.

Mauricio Scheffer

related questions