I have a standard .net ApiController
with the following code:
public class LibraryApiController : ApiController
{
private readonly ILibraryAssetRepository _repository;
public LibraryApiController() : this(new LibraryAssetRepository())
{
}
public LibraryApiController(ILibraryAssetRepository repository)
{
if(repository == null) throw new ArgumentNullException(nameof(repository));
_repository = repository;
}
}
I would like to get rid of the parameterless constructor, but then I run into the dreaded:
An error occurred when trying to create a controller of type 'ApiController'. Make sure that the controller has a parameterless public constructor.
I am using Sitecore's builtin dependency injection (Microsoft.DependencyInjection)
I have only found examples using SitecoreApiControllers. How do I solve this using an ApiController?