I am trying to use DI in my ASP.NET Web API Controller. Apparently there are a few implementations out there. I was just wondering which of these (Castle, Ninject, unity etc.) would be the easiest to configure/maintain in combination with ASP.NET Web API? I am getting this error:
DI.Controllers.ImportJsonController' does not have a default constructor.
If I add an empty constructor, then the constructor with IFilter
is ignored.
This is my controller:
public class ImportJsonController : ApiController
{
private readonly IFilter _filter;
public ImportJsonController(IFilter filter)
{
_filter = filter;
}
public HttpResponseMessage Post([FromBody]dynamic value)
{
//do something
return response;
}
}