Inversion of Control Container

noun

say it: “in-VUR-zhun uv kun-TROHL kun-TAY-ner” /ɪnˈvɝʒən əv kənˈtroʊl kənˈteɪnɚ/

A tool in a framework that makes an app's objects, in the right order, and hands each one the parts it asks for.

What is Inversion of Control Container?

An inversion of control container (DI container) is a framework tool that creates objects and hands them their dependencies automatically. You register "for IEmailSender, use SmtpEmailSender" once, and it wires everything up.

builder.Services.AddScoped<IEmailSender, SmtpEmailSender>();
builder.Services.AddScoped<OrderService>(); // gets an IEmailSender automatically

In a sentence

  • “We registered the checkout service once, and the inversion of control container made it for every request.”

Level: Master · More OOP terms at this level

Updated