Top "Service-locator" questions

The service locator pattern is a design pattern used in software development to encapsulate the processes involved in obtaining a service with a strong abstraction layer.

What's the difference between the Dependency Injection and Service Locator patterns?

Both patterns seem like an implementation of the principle of inversion of control. That is, that an object should not …

design-patterns dependency-injection service-locator
Accessing ASP.NET Core DI Container From Static Factory Class

I've created an ASP.NET Core MVC/WebApi site that has a RabbitMQ subscriber based off James Still's blog article …

c# asp.net-core dependency-injection rabbitmq service-locator
Dependency Injection vs Service Location

I am currently weighing up the advantages and disadvantages between DI and SL. However, I have found myself in the …

c# dependency-injection singleton dependency-management service-locator
Is ServiceLocator an anti-pattern?

Recently I've read Mark Seemann's article about Service Locator anti-pattern. Author points out two main reasons why ServiceLocator is an …

design-patterns dependency-injection anti-patterns service-locator
Which pattern to use for logging? Dependency Injection or Service Locator?

Consider this scenario. I have some business logic that now and then will be required to write to a log. …

c# design-patterns dependency-injection service-locator
ZF2 when to use getServiceLocator() and when not to

I am really confused on when to use getServiceLocator and when not to. As an example: + Module -+ Helloworld --+ …

php frameworks zend-framework2 service-locator
MVVM : how to pass parameter to ViewModel's constructor

I'm using L. Bugnion's MVVM Light Framework. What are some of the recommended approaches to pass parameters such as Customer's …

silverlight mvvm viewmodel mvvm-light service-locator
When would you use the Common Service Locator?

I've been looking at the Common Service Locator as a way of abstracting my IoC container but I've been noticing …

c# dependency-injection inversion-of-control service-locator common-service-locator
How do I NOT use DependencyResolver.Current.GetService(...) in this situation

Following the advice I have been given in this thread [Ninject UOW pattern, new ConnectionString after user is authenticated I …

c# dependency-injection ninject anti-patterns service-locator
Why does Unity use a Service Locator?

I have seen this line of code in several tutorials for using Unity in asp.net mvc3. I was under …

asp.net-mvc-3 unity-container service-locator