I have a very generic question.
When Developing with ASP.NET MVC. It provides a great way to utilize C# to interact with Client side objects like Query string.
I wanted to know how does ASP.NET MVC Framework converts Query String sent in GET request or Form Data in POST request to a Strongly Typed C# class? Are there any specific HttpHandler or HttpModules for this? Or are they using any Pre-Defined Action Filter?
I want to implement similar feature in WCF based RESTFull services. I believe I will need to use Interceptor for this purpose.
Please provide some advice.
Thanks in Advance.
You’re referring to ASP.NET MVC Model Binding. This is actually a completely separate part of the framework than
ActionFiltersor HttpModules. It works by examining “value providers” – the sources of information in the request, like form data, the query string, or even the route – and attempting to match them by name to properties in the complex type in your controller action.As Kenneth mentioned, you can check out the source on CodePlex, but if you’re looking to write services using RESTful architectural patterns you can start using the Web API features in the MVC4 beta, which also supports model binding (so you won’t have to reinvent it!)
It’s also worth mentioning that the Web API was being developed for WCF but is now a part of ASP.NET MVC, which makes sense since ASP.NET MVC, like the Web API, are both built primarily around HTTP.