aspnet / AspNetWebStack

ASP.NET MVC 5.x, Web API 2.x, and Web Pages 3.x (not ASP.NET Core)
Other
858 stars 354 forks source link

Support for Polymorphic Custom Model Binding #257

Closed Exagram closed 3 years ago

Exagram commented 5 years ago

For one endpoint I am required to handle different POST payload types:

Example endpoints: POST /api/message with payload { type: people, profile { ... } } POST /api/message with payload { type: invoice, lines: [ ... ] }

I found an ASP.NET Core Web API 2 solution but I am not using Core: https://docs.microsoft.com/en-us/aspnet/core/mvc/advanced/custom-model-binding?view=aspnetcore-2.2. Second I am looking for an automatic approach such as: if (modelType.Equals("people") DefaultBuiltinModelBinder.Bind<PeopleModel>(model). In contrast the tutorial provides a manual solution.

Related: https://github.com/aspnet/Mvc/issues/3722

mkArtakMSFT commented 3 years ago

Thanks for contacting us. This repo is in maintenance only mode and we won't implement new features in it. We only fix critical bugs and security issues.