ASP.NET Dynamic Data - a boon for developers

Vishvvas
Posted by in ASP.NET category on for Advance level | Points: 250 | Views : 8895 red flag
Rating: 5 out of 5  
 1 vote(s)

In this article we shall learn ASP.NET Dynamic data. With .NET 3.5, a new cool feature is added named as Dynamic Data which is a RAD development paradigm for building functional websites.

Objective

To explore ASP.NET dynamic data and learn about its implementation.

Introduction

With the rate of changes/ additions of features in the .Net framework, many of very good features don’t get the deserved attention.  Especially on the ASP.NET front, there have been many such features haven’t caught the eye of developer. Dynamic data which was introduced with ASP.Net 3.5 (SP 1) is one of such cool new addition in the archery of ASP.Net. 


Precisely ASP.NET dynamic data provides a framework which enables quick building of functional data driven application that are based on Microsoft ORM i.e. LINQ TOSQL or Entity framework data model. It has added smart validation and ability to change the display with templates to DetailsView, FormView, GridView, and ListView controls. As per Microsoft, the dynamic data framework enables major usability and RAD development changes to work with data model. The LINQTOSQL or EF can be registered with dynamic data to result into a fully functional web site. It supports all CRUD operations. We will explore dynamic data website with .NET framework 4.0.

Description

Let’s start a small demonstration (employing Entity Framework) step by step.
Environment: VS 2010, SQL Server 2008 with “AdventureWorks” database
 
Step 1: Create a web project with template “ASP.Net Dynamic Data Entities Web Application”.



Step 2:  Add an “ADO.NET Entity Data Model” into the project. 



Step 3:  As we are going to use “AdventureWorks” database, choose option “Generate from Database” for generating the data model from database. 




Step 4:  Choose the database and database connection .



Check the checkbox for saving the entity connection string in “Web.config” file.


Step 5:  Select the database objects like Tables, views to be included in the model. 



Step 6:  Make sure the name of the data model is referred in “Global.asax”. 
 

Step 7:  Make sure that model namespace is referred in the connection string of “web.config” file. 
  

 
Here we are with all prerequisites done and oh, it wasn’t too much of work. Rather is so straightforward and simple that it’s difficult to believe. 
 

Output

Lets run the web application and see the output. 


Screen 1: This is the default page loaded into the browser when one runs the application. This lists all the tables in the data model.

Screen 2: This is the “List” page loaded into the browser when one clicks the “table” in the default page and show the records in the selected table with options for performing CRUD operations. 

  
 

Summary

When one creates the dynamic data projects, visual studio different entity templates for default, edit and insert pages along-with the page templates for the same. Different templates for fields, filters are also created automatically. For scripting “JQuery 1.4.1” is also included. Templates are used in place of programming hard coded rules in controls.



Conclusion


ASP.NET Dynamic data framework is boon for RAD development and it’s very easy to create functional web sites. Best part is AJAX implementation is also taken care off. Also it goes hand in hand with EF or LINQTOSQL easing out the implementation with ORM’s. Validation is also taken care-off. The templates can be customized to change their appearance. 


So is it a start of “TDD” – Template Driven Development? 


References

http:// weblogs.asp.net/scottgu/archive/2007/12/14/new-asp-net-dynamic-data-support.aspx
http:// www.asp.net/dynamicdata 

Page copy protected against web site content infringement by Copyscape

About the Author

Vishvvas
Full Name: Vishwas Sutar
Member Level: HonoraryPlatinum
Member Status: Member,MVP
Member Since: 5/30/2011 2:13:10 AM
Country: India

http://www.dotnetfunda.com
Extensive and rich experience across gamut of technologies and programming languages like PB,VB,C++,VB.NET, C#, Classic ASP,ASP.NET, ASP.NET MVC.

Login to vote for this post.

Comments or Responses

Posted by: Akiii on: 7/23/2011 | Points: 25
Its a nice explanatory article......
the image resolution is not good though....!

Thanks and Regards
Akiii

Posted by: Ashuthinks on: 7/24/2011 | Points: 25
super like : ) something new to learn
thanks - Vishwas Sir

Posted by: Vishvvas on: 7/25/2011 | Points: 25
Akiii,
Its good that the article helped you.Yeah, few of the images are not clear mostly because of the styles. These appear with default style for Dynamic data fraework. If time permits, definitely I would like to see through to have better images.
Regards
Posted by: Hiren009 on: 7/25/2011 | Points: 25
Thanks a lot for such knowledge sharing...


Login to post response

Comment using Facebook(Author doesn't get notification)