Reputation: 54127
We are planning to use ASP.NET MVC on a relatively important (to the business) project. The development team comprises 4 developers and a Technical Lead. 2 of the devs and the Tech Lead have worked together before on ASP.NET WebForms project and are confident using that technology.
We cringe a little when we look back at some of the approaches used on some of our first WebForms project (examples include excessive use of UpdatePanels, lack of knowledge of controls such as the ListView, bloated ViewState etc).
It is important that we do not look back on this project in a year and cringe at some of our ASP.NET MVC approaches!
Based on experience, does anyone have any key risks they can cite when using ASP.NET MVC for the first time?
I am thinking about gotchas, lightbulbs that took a while to go on, parts of the framework that you felt you were fighting until you learnt a specific item, that sort of thing.
Upvotes: 10
Views: 550
Reputation: 3680
The biggest risks that I've seen come from a return to a stateless medium.
Postback is gone. Most server controls are gone. Viewstate is gone. Event driven model is gone.
If your devs have ONLY used asp.net webforms to build sites, and never another web technology, they are in for a lot of learning.
Upvotes: 2
Reputation: 25280
You can download a free eBook from Scotts Guthrie's blog take gives you a full in-depth guide on how to build an ASP.NET MVC site from scratch.
Upvotes: 2
Reputation: 181044
Use Strongly Typed Views and create a new Model for each view
Simple reason: That is to make sure your Model is separted from your View. If you need to do refactoring, you only break one part. So if you have a View called "Latest News", you should have a "LatestNewsViewModel". It's then the job of the controller to get the data from the actual Model/Database and create a View Model that it passed into your views. Also, if you decide that you need additional stuff in your View, you don't have to refactor the entire Data Access Layer, as you only have to change the ViewModel and the Controller action that populates it.
Performance
I recommend checking out this slideshow about performance concerns and optimizations which can make a huge impact.
Upvotes: 7
Reputation: 9103
The biggest ones for me were understanding Model Binding and that you can have typed views.
Also properly securing your routes.
Upvotes: 0