From the course: Learning Entity Framework Core

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Context and dependency injection

Context and dependency injection - Entity Framework Tutorial

From the course: Learning Entity Framework Core

Start my 1-month free trial

Context and dependency injection

- [Instructor] Okay, we are now ready to register our context with dependency injection. The concept of dependency injection is really central to ASP.NET core, and services like our ActorDbContext here are registered with dependency injection during application startup. And components that require these services like our MVC controllers, they're provided these services via constructive parameters or properties. For more information on dependency injection you can take a look at this site here. It's a Microsoft site and have a good detailed explanation about it. But dependency injection can become really intricate as you get deeper into it, but on a high level, it's really all about decoupling your code. And it allows you to write code in a way that your program can create objects on a fly when it needs it. That's really a short version of it, but it can become much more intricate depending on how you're using it. But this is a good article to give you a high level description of it…

Contents