Giter Club home page Giter Club logo

Comments (5)

svermeulen avatar svermeulen commented on July 28, 2024

This is how it should work. Can you explain the case in which you are seeing this?

from zenject-2019.

bbdb68 avatar bbdb68 commented on July 28, 2024

thinking about it, this is probably because the object is also IInitializable. Will make a test asap.

from zenject-2019.

bbdb68 avatar bbdb68 commented on July 28, 2024

My mistake, Zenject is effectively lazy, but the object we considered was effectively IInitializable. When removing the initialization, the object is not instantiated

from zenject-2019.

svermeulen avatar svermeulen commented on July 28, 2024

Yep, exactly. The InitializableManager has a dependency on all IInitializables and the UnityDependencyRoot has a dependency on InitializableManager so it's always created on startup.

from zenject-2019.

svermeulen avatar svermeulen commented on July 28, 2024

You might want to use [PostInject] instead which will keep it being lazily instantiated, but [PostInject] will be called in the middle of the construction of the initial object graph, so that may not be ideal.

I prefer using IInitializable for startup objects so that initialization occurs after the complete construction of the initial object graph, and also so that I can explicitly control the order that objects are initialized in, in case I need that.

from zenject-2019.

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.