How do I use custom model binder that supports dependency injection in ASP.NET Core?
问题 I am trying to use a custom model binder in MVC that I want resolved from my IoC container. The issue I am having is that I can't access my container while I am adding the MVC service, because my container isn't built yet (and I need to add MVC before building my container). Feels like a chicken/egg issue, and I am sure I am missing a simple solution. Example: services.AddMvc().AddMvcOptions(options => { options.ModelBinders.Add(serviceProvider.Resolve<CustomModelBinder>()); }); My custom