Alex Rivera | Logout

Best Practices for ASP.NET MVC

Asked 2009-08-23T00:40:13.653
30

Basically, this 'question' is intended to pool information about best practices in the community. The reasons for this are:

  • The distinct lack of an community based ASP.NET MVC resource for best practices. Yes, I am aware of wiki.asp.net.
  • I'm painfully aware that the ASP.NET wiki on ASP.NET MVC is woefully small and terribly out of date and needs fleshing out more by Microsoft before the community does anything with it.
  • I'm very much interested in best practices in general, having had a fair degree of experience with ASP.NET MVC over the last year, but I'm also mindful that I'm no expert, and that I can definitely improve. This post, I believe, can help that, and you.

I gave some serious thought on whether or not I should ask this question, even going to the lengths of creating a question on meta about creating this question. :)

What I am looking for is for best practice information on all aspects of ASP.NET MVC. Controllers, models, extensions, HTML helpers, route builders, TDD.

In the past, I have found resources, such as Kazi Manzur Rashid's best practices (part 1 and 2) post quite useful, along with Maarten Balliauw's weigh-in, but these have dried up somewhat, and I was hoping for a more dynamic and growing repository of information from different people, rather than just the occasional blog entry from learned individuals.

Edit
Report

2 Answers

3

Keep your controllers as "thin" as possible. Simply have them validate data coming in from the form, and then calling the model (which does all the real work) to get the data to be returned in your next View.

Having complex controllers kind of breaks the MVC concept.

answered 2009-08-23T21:49:44.090
1

This is how i handle all DropDowns in my application and i wanna share with you cause i think it's sorta best practice:

One EditorTemplate for all DropDownLists in ASP.Net MVC

answered 2012-01-16T15:49:07.607

Your Answer