An Introduction to ASP.NET Dynamic Data from a Beginner's Perspective


There are quite a few websites running on the internet and a lot of intranet applications being used which mainly provide the user interface to manipulate databases. The websites were developed as ASP.NET forms typically retrieving, inserting, updating data. With ASP.NET dynamic data websites, creation of such data centric web applications has become very easy. Dynamic data websites are also very useful in creating website administration portals where the administrator can easily access the database from a web based interface created by the ASP.NET dynamic data project. Dynamic data websites work on top of the scaffolding framework from Microsoft. The basic idea behind a dynamic data website is that once we have a database ready with us, we can create a data context for this database using either "LINQ to SQL" or "Entity Framework". Once we have the data context ready with us, we can use this context, and the web pages that will perform database operations will be generated at runtime. The important thing to notice is that a dynamic data website generates pages at runtime and it is not some auto generated code by Visual Studio. It does use some template pages and controls to render the actual data, which in fact is a good thing because it gives us the possibility of customization as per our needs.

Creating a dynamic data website

Let us start by creating a new dynamic data website. We can create a dynamic data website or a dynamic data project. Once we have the dynamic data website created, the first thing we have to look into is how to use the database. Let us put the database in the APP_Data directory.. The next thing we need to do is add a data source mapping by using wither LINQ to SQL or the Entity Framework. Let us use Entity Framework for this article. Irrespective of the type we are choosing here, the basic philosophy will remain the same.