How do I use custom model binder that supports dependency injection in ASP.NET Core?
Per the post here: https://github.com/aspnet/Mvc/issues/4167
To answer your question directly, use:
bindingContext.OperationBindingContext.ActionContext.HttpContext.RequestServices
On a side note, you also have the option of using [FromServices]
to resolve it for you.