Skip to content

4.7.5: Singleton instances differ between parent and child when first created within child container #392

Answered by dadhi
cnruehl asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @chrisg32 ,

My main problem with the child containers is that slightly different expectations on what and how should they work by default.
That's why it took me so long to provide the specific method CreateChild but anyway it does not solve everyone's problem.
Here is the current CreateChild implementation:

        public static IContainer CreateChild(this IContainer container, 
            IfAlreadyRegistered? ifAlreadyRegistered = null, Rules newRules = null, bool withDisposables = false)
        {
            var rules = newRules != null && newRules != container.Rules ? newRules : container.Rules;
            return container.With(
                container.Parent,
                i…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@cnruehl
Comment options

@dadhi
Comment options

@cnruehl
Comment options

@dadhi
Comment options

Answer selected by cnruehl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants