Click here to Skip to main content
15,891,951 members
Articles / Web Development / HTML

A Custom Model Binder for Passing Complex Objects with Query Strings to Web API Methods

Rate me:
Please Sign up or sign in to vote.
4.74/5 (21 votes)
17 Jan 2018CPOL13 min read 158.6K   3K   51  
Custom model binder for passing query strings as nested objects or collections to Web API GET or POST methods, also updated for ASP.NET Core
In this article, the custom FieldValueModelBinder class has been presented which can be efficiently used for passing complex objects with query strings to Web API methods. It’s simple to use, especially for a GET method receiving a query string as a nesting object. For a nesting collection object, the FieldValueModelBinder class provides an option when using query string sources for any GET, POST, or PUT methods.

Views

Daily Counts

Downloads

Weekly Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
Shenwei is a software developer and architect, and has been working on business applications using Microsoft and Oracle technologies since 1996. He obtained Microsoft Certified Systems Engineer (MCSE) in 1998 and Microsoft Certified Solution Developer (MCSD) in 1999. He has experience in ASP.NET, C#, Visual Basic, Windows and Web Services, Silverlight, WPF, JavaScript/AJAX, HTML, SQL Server, and Oracle.

Comments and Discussions