This is a migrated thread and some comments may be shown as answers.

Decompiling service locator pattern

1 Answer 13 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Charlie
Top achievements
Rank 1
Charlie asked on 03 May 2013, 06:36 AM
Hi,

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 :

    [ServiceConsumer]
    internal static class ServiceLocator
    {
        [ServiceDependency]
        public static IService1 Service1;

        [ServiceDependency]
        public static IService2 Service2;

        [ServiceDependency]
        public static IService3 Service3;

        [ServiceDependency]
        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 :

ServiceLocator.Service1.SomeMethod();

1 Answer, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 10 May 2013, 08:37 AM
Hi,

Sorry for the late response. Can we get a copy of the aforementioned assembly so we can investigate the code snippet further?

Regards,
Kaloyan
the Telerik team
Tell us what you think about JustDecompile. Your opinion matters! You can use our forum, or our JustDecompile UserVoice website for feature requests.
Tags
General Discussions
Asked by
Charlie
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Share this question
or