dotnet/aspnetcore

Add support for TypeConverter on propertes/parameters in MVC

Open

#8857 aperta il 27 mar 2019

Vedi su GitHub
 (9 commenti) (4 reazioni) (0 assegnatari)C# (10.653 fork)batch import
affected-fewarea-mvcenhancementfeature-model-bindinghelp wantedseverity-minor

Metriche repository

Star
 (37.933 star)
Metriche merge PR
 (Merge medio 16g 9h) (258 PR mergiate in 30 g)

Descrizione

Discussed here originally: https://github.com/aspnet/AspNetCore/issues/8846

This is a really simple way to implement model binding behaviour, and is a totally appropriate thing to do when you have a single field in the request that maps to a complex object.

It would be easy for us to support this because we already have infrastructure that users model binding to call a type converter. We already use type converters defined on types, what this would add would be the ability to use types like List<> and apply the attribute to provide a converter.

Guida contributor