service locator

An anti-pattern in which code asks a global container for its dependencies at the point of use instead of receiving them in its constructor.

In more detail

It hides what a class needs and makes it hard to test. The .NET container is meant for composition at the edges, not to be called from everywhere.

Related terms

Taught in

References