When integrating simple injector in to a pure .net core web api project, should I still use the "ASP.NET Core MVC Integration NuGet package"? I was expecting to find a separate integration package similar to older .net versions. Or is SimpleInjector.Integration.WebApi
intended to be used for .net core as well?
With the introduction to ASP.NET Core, Microsoft created one unified model that integrates both MVC and Web API. They called this framework: ASP.NET Core MVC. This means that creating a Web API project, you use Microsoft.AspNetCore.Mvc.
This is why, when integrating Simple Injector with a ASP.NET Core MVC Web API project, you will have to use the SimpleInjector.Integration.AspNetCore.MVC
or SimpleInjector.Integration.AspNetCore.MVC.Core
package. Most likely, in your case, you should use the SimpleInjector.Integration.AspNetCore.MVC.Core
, since it contains extension methods to register controllers, while SimpleInjector.Integration.AspNetCore.MVC
builds on top of the Core package and adds MVC Razor Tag Helper integration, which is something you won't need when creating a Web API.