The dependency injection concept is a fundamental part of ASP.NET Core. A dependency injection system comes out of box with the ASP.NET Core framework, and it is the preferred way to instantiate components in our application.
ASP.NET Core usually describes types that are managed by the dependency injection container as services. Therefore, all the services are stored in the built-in container that is represented by the IServiceProvider interface.
In the next part of the chapter, we will see some examples of dependency injection. As a first step, let's create a new class in the SampleAPI project inside the Controllers folder, called ValuesController.cs:
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
namespace SampleAPI.Controllers
{
[ApiController]
[Route("[controller]")]
public class ValuesController...