Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes, it can be perfectly fine, especially in case of <code>something --&gt; transient</code>. The things you need to worry about is:</p> <ul> <li>am I forcing this component to live (and stay in memory) longer than it should?</li> <li>am I not going to end up in a situation where the object I depend on gets released automatically (like in case of a singleton that depends on a per-web-request object, which gets released when the first web request ends). In that case you will end up using object in an invalid state, which depending on how you implement it will either throw an exception (fail fast) or misbehave (you don't want to be there).</li> </ul> <p>If you've considered those two, and potentially a number of other factors specific to your scenario, you're in a good position to make an informed choice to press on with the dependency.</p> <p>Alternatively you can make it a transitive dependency via a layer of indirection:</p> <p><code>singleton -(depends on)-&gt; singleton factory -(resolves)-&gt; per-web-request component</code>.</p> <p>A singleton object may depend on a factory which it uses to pull, say, per-web-request objects that it uses to do its job. With that, if implemented properly, it won't have the drawbacks discussed above.</p> <p>Hope that helps.</p> <p>Oh, and the other answer of mine, you linked to in your question - it says <em>rule of thumb</em>, not strict law. It's probably right in majority of cases, but, as discussed above, it's fine to break it if you know what you're doing. That's also the reason why Windsor's diagnostic for detecting those cases is called <em><strong>Potentially</strong> misconfigured components</em></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload