Best practices for "search data class" in ASP.NET MVC

Posted by Tim Ridgely on Stack Overflow See other posts from Stack Overflow or by Tim Ridgely
Published on 2010-04-06T18:17:41Z Indexed on 2010/04/06 18:23 UTC
Read the original article Hit count: 179

Filed under:

Hi everybody, I'm hoping this isn't too subjective, but I'm new to ASP.NET MVC and I'm trying to figure out how others may have solved similar problems.

Basically, I have two entities, Customers and Orders. A customer has many orders; an order belongs to exactly one customer. I'm making an Order Search feature that should allow a user to search for orders based on order or customer information. Pretty straightforward, I think.

I've read in other posts that the search controller should use GET, but I think it makes more sense to use POST because of the large number of search params.

I'm using Entity Framework to create my models, and that's in a separate class library project and namespace.

This article talks about using binding instead of Request.Form to get at the POST data. Would it make decent sense to make a class to hold all the search data that could be materialized by the magic model binding? Otherwise I'd just be poking through the FormCollection to pull out particular values, which might be fine. Where would you recommend making such a class?

© Stack Overflow or respective owner

Related posts about asp.net-mvc