_:ndb360da320034a699821741898c1a9c1xb1
<http://schema.org/text>
"My controller:  [Route(&#39;api/[controller]&#39;)] [ApiController] public class CategoriesController : ControllerBase { private readonly IUnitOfWork unitOfWork; public CategoriesController(IUnitOfWork unitOfWork) { this.unitOfWork = unitOfWork; } [HttpGet] [Route(&#39;TestCategories&#39;)] public ActionResult&gt; TestCategories() { return unitOfWork.Categories.FindAll().ToList(); } } My Startup:  public void ConfigureServices(IServiceCollection services) { services.Configure(options =&gt; { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context =&gt; true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddDbContext(options =&gt; options.UseSqlServer(Configuration.GetConnectionString(&#39;DefaultConnection&#39;))); services.AddScoped(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); } I did break my app so i can understand how the codes work. As you can see on my controller i used IUnitOfWork (Interface that comes from MyProject.Domain - class library)  Scenario:  if i use the UnitOfWork class, the only thing the i need to inject (to startup.cs) is the UnitOfWork class only. if i use the IUnitOfWork interface. i need to inject both (to startup.cs) IUnitOfWork interface and UnitOfWork class as well because it gives error see below.  "
<https://qawithexperts.com/questions/323/aspnet-core---dependency-injection>