O'Reilly logo

Professional ASP.NET MVC 4 by Scott Hanselman, K. Scott Allen, Brad Wilson, Phil Haack, Jon Galloway

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

ASP.NET Dynamic Data

ASP.NET Dynamic Data is a feature that's often been ignored by ASP.NET MVC developers because it's a Web Forms feature. True, it is built on top of Web Forms, but that's really just an implementation detail. ASP.NET MVC and Web Forms are all ASP.NET applications and can be intermingled in productive ways.

For the NuGet Gallery, we decided to use Dynamic Data as an extremely fast way to build out a scaffolded administration UI so that we could edit data in the database via a browser. Eventually, we hope to build out a proper administration section to manage the gallery, but Dynamic Data works great in a pinch. Because this is an admin page, the details of the UI weren't important to us, though Dynamic Data is certainly customizable if we wanted to build a fancier UI.

To see Dynamic Data in action, make sure the Website project is set as the startup project and hit Ctrl+F5 to start it up in the browser. Append /dbadmin to the URL to visit the database admin site. Since you're running the site on the local host, it doesn't require that your user account is a member of the “Admins” role. It only requires that you are authenticated. So, register an account and then visit /dbadmin. When running remotely, the /dbadmin section also requires that you be a member of the Admins role.

You should see a list of every table in the database, as shown in Figure 16.3. Technically, not every table is listed, just those that correspond to an Entity Framework entity.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required