wivuu / Wivuu.JsonPolymorphism

Adds System.Text.Json serializer support for polymorphism with a discriminator attribute
MIT License
25 stars 3 forks source link

Enhance model binding support for ASPNET core #7

Open onionhammer opened 2 years ago

onionhammer commented 2 years ago

Currently in ASP.NET Core, writing a generic IModelBinderProvider is difficult, because there is no way to generically constrain that T has GetAllTypes or GetType static methods. These two helper methods allow the caller to understand all the possible supported types and get a type from a passed enum respectively.

Proposal: Declare and a known interface with GetAllTypes and GetTypes then have each polymorpyhic class inherit that interface