GithubHelp home page GithubHelp logo

Comments (6)

alistairjevans avatar alistairjevans commented on July 17, 2024 1

I'd recommend reading the content at the beginning of this thread for an explanation as to why it isn't simpler to allow a container update.

Placeholder objects aren't your only option; you can use delegate registrations, or organise your child scopes so you can change the dependencies per-scope.

from documentation.

natrexjacobs avatar natrexjacobs commented on July 17, 2024

This may tie into #99 if the Update() removal is the root issue there?

from documentation.

tillig avatar tillig commented on July 17, 2024

This issue is more specifically to write a new article to explain how to work with immutable containers. I'll leave the other issue open so this one can be separately tracked.

from documentation.

StefanoVuerich avatar StefanoVuerich commented on July 17, 2024

How can I add a registration to the global scope after build?

from documentation.

alistairjevans avatar alistairjevans commented on July 17, 2024

@StefanoVuerich; typically questions like that should be asked on Stack Overflow, rather than added as comments on existing issues.

That being said, the short answer is that, after Autofac 5.0, you cannot modify the global scope after it has been built. Child lifetime scopes can continue to have custom registrations within that scope. See https://autofaccn.readthedocs.io/en/latest/best-practices/#consider-a-container-as-immutable for some more detail.

from documentation.

StefanoVuerich avatar StefanoVuerich commented on July 17, 2024

@alistairjevans
After googling a bit found that PreserveExistingDefaults works.
It it really the best solution to force people add a kind of "place holder object", that can be later on overrided?
Wouldn't be simpler to let the container have the possibility to add a new registration?

from documentation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.