Using Model Binders in ASP.NET Core
In this post we will discuss Model Binders in ASP.NET Core applications. ASP.NET Core is a unified story for building Web UI using Razor Views and Web APIs. Web UI can be rendered using PageModel class (like we have Page class in WebForms) and Controllers (like MVC Controllers). The Razor pages, Controllers (MVC and Web API) works with data that comes from various HTTP requests. The data may be posted using HTTP Body, Route data values, Form Fields. When data is received from such variations then writing code to read such data and map this data with .NET CLR type on server-side is tedious and complex job. The Model Binding is used to simplify this complexity. Model Binding automates the process of mapping the data to .NET CLR types. The Model Binders provides following features It retrieves data received from Form fields, Http Body, Route parameters and query strings. The received data is provided to controllers as method parameters. The data is further c...