Code Monkey home page Code Monkey logo

Comments (3)

A-Kjeldgaard avatar A-Kjeldgaard commented on August 23, 2024 1

My expectation is: if there is no registrations where the service type is type Thing, then no elements should appear when injecting a collection/enumerable/list.

If I add registrations for Thing, I would expect one item in the injected collection for each registration added.

Examples of registrations:

container.RegisterInstance(new Thing { Id = Guid.NewGuid() });
container.RegisterDelegate(rc => new Thing { Id = Guid.NewGuid() });
container.Register<Thing>();

If I was to inject Thing directly, as such:

public MyRegistry(Thing thing) { ... }

Then I would expect the container to instantiate an instance of Thing.

So to sum up, I only expect dynamic registrations to result in an instance when service type is directly requested, not when inside a range type.

from dryioc.

dadhi avatar dadhi commented on August 23, 2024

@A-Kjeldgaard, thank you for the example and the detailed description. I will look.

from dryioc.

dadhi avatar dadhi commented on August 23, 2024

@A-Kjeldgaard What do you mean by this?

If item has been registered, then issue does not occur.

If I am registering Thing then it will appear in the injected collection as intended.

As I understood, you would like to avoid automatic concrete type instantiation with WithConcreteTypeDynamicRegistrations, right?

BTW, WithAutoConcreteTypeResolution works this way because they do not Wrappers in general, including the collection one.

from dryioc.

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.