Dynamic Data, in ASP.Net is the greatest thing since sliced bread, in my humble opinion. Using it, you can easily create really good SQL Server table Admin applications, to do all your CRUD work. And, for those of you who don’t know, CRUD stands for Create, Read, Update and Delete.

How many times have you built what you think is a great website, and then, you realize it’s not over, because you need to build an ‘Admin’ section for the database. Well, Dynamic Data has come to the rescue!

Now, to start off with, this tutorial assumes you are working with SQL Server.

To show you how easy it is to build something like this, I will merely list the steps:

  • In Visual Studio, create a new website, choosing ‘Dynamic Data Web Site‘.
  • Then, add a new item to the site – ‘Linq to SQL Classes’ (click OK when prompted to add it to the APP_Data Folder).
  • Go to the Server Explorer window, and choose the connection to the database you wish to use, and choose each of the tables you want to have in your Admin section, dragging them to the ‘Object Relational Designer‘.
  • Double-click on the Data Classes designer code file, and copy the name of the class which was created to the clipboard.
  • Open up the Global.asax file, and find the commented line that says: “model.RegisterContext(GetType(YourDataContextType), New ContextConfiguration() With {.ScaffoldAllTables = False})
  • Highlight the ‘YourDataContextType and paste in the name of the class you have on the clipboard.
  • Change the ScaffoldAllTables property from False to True

That’s it, you have a full-functioning database admin section for your web site!