Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5977775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:25:08+00:00 2026-05-22T21:25:08+00:00

At a high level, how do these dep. injection frameworks work? I can understand

  • 0

At a high level, how do these dep. injection frameworks work?

I can understand if you always instantiate an object via a custom factory like:

IUser user = DepInjector.Get<User>();

I’m guessing what happens is, wherever you defined the mappings, it will look at the type you want and try and find a match, if found, it will via reflection instantiate the type.

Are there dep. inj. frameworks that would work like:

IUser user = new User();

If so, how would it get the correct user, where is it hooking into the CLR to do this? In case of an asp.net website, is it any different?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:25:09+00:00Added an answer on May 22, 2026 at 9:25 pm

    If you want to know how Ninject works then the obvious place to start would be reading How Injection Works on their official wiki. It does use reflection but it now also uses dynamic methods:

    “By default, the StandardKernel will
    create dynamic methods (via
    System.Reflection.Emit.DynamicMethod)
    that can be used to inject values into
    the different injection targets. These
    dynamic methods are then triggered via
    delegate calls.”

    As for you second example, I don’t believe there are any DI frameworks that would do what you ask. However, constructor injection tends to be most common way of implementing IoC, so that when a class is constructed it knows what type to bind to via some configuration binding. So in your example IUser would be mapped to concrete User in config bindings so that any consuming class that has an IUser parameter as part of its constructor would get the correct User type passed in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When writing object-oriented software, I use dependency injection a lot: to compose together high-level
So on a high level I understand the concept of dependency injection. Our company
can someone give me a high level overview of these two methodologies? what's the
Are there compilers for high-level languages (such as C) which can be targeted to
High Level With StructureMap, Can I define a assembly scan rule that for an
Where can I get a decent high-level description of the algorithm used in __merge_without_buffer()
Not getting into too many specifics, this is a high level question. I've always
I work on a high-level simulator written in C++ for some hardware that is
This is a high-level question about web frameworks, that as a desktop app developer,
I'm currently estimating a new project. My high level estimate assuming there was one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.