I decompiled an assembly that uses a service locator pattern. The results were somewhat lacking and I wonder if this is a consequence of the SL pattern being loosely coupled?
So for example
I get :
internal static class ServiceLocator
public static IService1 Service1;
public static IService2 Service2;
public static IService3 Service3;
public static IService4 Service4;
Which doesn't actually show the code that would instantiate Service1, 2, 3 or 4 so if you use this example, Service 1 will always be null if you try to use the class.
Being relatively new to the service locator pattern, would anyone care to hazard a guess as to how it should look?
For example in code where this class is used I can see things like :