Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 719249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:37:13+00:00 2026-05-14T05:37:13+00:00

DISCLAIMER: I know there is debate between DI and service locator patterns. I have

  • 0

DISCLAIMER: I know there is debate between DI and service locator patterns. I have a question that is intended to avoid the debate. This question is for the service locator fans, who happen to think like Fowler “DI…is hard to understand…on the whole I prefer to avoid it unless I need it.” For the purposes of my question, I must avoid DI (reasons intentionally not given), so I’m not trying to spark a debate unrelated to my question.

QUESTION: The only issue I might see with keeping my IOC container in a singleton (remember my disclaimer above), is with the use of child containers. Presumably the child containers would not themselves be singletons. At first I thought that poses a real problem. But as I thought about it, I began to think that is precisely the behavior I want (the child containers are not singletons, and can be Disposed() at will).

Then my thoughts went further into a philosophical realm. Because I’m a service locator fan, I’m wondering just how necessary the notion of a child container is in the first place. In a small set of cases where I’ve seen the usefulness, it has either been to satisfy DI (which I’m mostly avoiding anyway), or the issue was solvable without recourse to the IOC container. My thoughts were partly inspired by the IServiceLocator interface which doesn’t even bother to list a “GetChildContainer” method.

So my question is just that: if you are a service locator fan, have you found that child containers are usually moot? Otherwise, when have they been essential?

extra credit: If there are other philosophical issues with service locator in a singleton (aside from those posed by DI advocates), what are they?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:37:13+00:00Added an answer on May 14, 2026 at 5:37 am

    IMHO:

    • Child containers have nothing to with service locators, i.e. they’re orthogonal. Using a container as a service locator is just that, a way to use it, and it has nothing to do with the container supporting child containers or not.
    • Child containers usage depend largely on container design. For example, while Windsor supports them, they’re seldomly used. Autofac OTOH uses them heavily to manage scope / component lifecycles. And it’s an entirely optional feature of any container / service locator implementation, that’s why IServiceLocator doesn’t mention it. IServiceLocator’s job is to provide the lowest common denominator in a service locator.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I will preface this question with the disclaimer that I know there are many
The Disclaimer First of all, I know this question (or close variations) have been
Disclaimer: I know there are quite a few questions out there with this topic
I know that there is code like this: http://www.java2s.com/Code/Android/Security/RSAencryptdecryptfunctionRSAECBPKCS1Padding.htm /* Copyright (c) 2010, Sungjin
Disclaimer: I know this type of question has been asked here before, I just
Disclaimer: I know there are better ways to track email open rates, which are
Question: How can I document Ruby code using Doxygen? Disclaimer: I know ruby already
Disclaimer: this question is driven by my personal curiosity more than an actual need
Disclaimer: I tried to search for similar question, however this returned about every C++
Disclaimer: I know this is a bad way to do things. It is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.