We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am trying to use a custom model binder in the new minimal APIs but it does not seem that this is possible at the moment.
In the controller based approach I could create a custom binder as such
public class CustomBinder<TEvent> : IModelBinder { ... } public class CustomBinderProvider : IModelBinderProvider { ... }
and register it in Startup.ConfigureServices
Startup.ConfigureServices
services.AddControllers(options => { options.ModelBinderProviders.Insert(0, new CustomBinderProvider()); });
and then use it
[HttpPost("foo-endpoint")] public IActionResult Post(Foo customType) => Ok();
Where the CustomBinderProvider would react to the Foo and use the CustomBinder.
CustomBinderProvider
Foo
CustomBinder
Using a custom model binding in the minimal API setup so it's possible to do the same as described above, or achieve the same result.
app.MapPost("foo-endpoint", (Foo customType) => "ok");
The text was updated successfully, but these errors were encountered:
We're tracking discussion of future support for customizing parameter binding in Minimal APIs in #35489
Sorry, something went wrong.
No branches or pull requests
Is your feature request related to a problem? Please describe.
I am trying to use a custom model binder in the new minimal APIs but it does not seem that this is possible at the moment.
In the controller based approach I could create a custom binder as such
and register it in
Startup.ConfigureServices
and then use it
Where the
CustomBinderProvider
would react to theFoo
and use theCustomBinder
.Describe the solution you'd like
Using a custom model binding in the minimal API setup so it's possible to do the same as described above, or achieve the same result.
The text was updated successfully, but these errors were encountered: