Pages

Sunday, May 15, 2011

MvcScaffolding: One-to-Many Relationships

Recently I've looked again at the most rapid way to implement basic CRUD for a relational data, using web application in .Net. From experience I knew that Web Forms had ways of getting this sort of thing done in a quick (and dirty) way. That was made even easier with recent version of WebForms. Now, looking at what MVC can do, I was quite pleasantly surprised.

A couple of weeks ago I looked at Scott Hanselman's presentation where he demonstrates some MVC Scaffolding templates. This was the missing bit but the things are falling into place. T4, NuGet, and now scaffolding. There are templates for a few things already and there will obviously be more in the not-so-distant future.

Here is an article in an excellent series about MVC Scaffolding. Steve Sanderson explains how to do one-to-many relationship and CRUD through a scaffolding template. He is using Entity Framework Code First approach to generating the data model. The templates do the rest in generating controllers and views, as well as the model.

No comments: