Monday, December 17, 2007

ASP.NET Dynamic Data Support - Scott G

ASP.NET Dynamic Data Support

This is one of the cool new feature - "ASP.NET Dynamic Data Support". In a nutshell this enables us to really quickly build data driven web-sites that work against a LINQ to SQL (and in the future LINQ to Entities) object model - and optionally allows you to-do this Without Having To Build Any Pages Manually.

Below steps are required to work with this:

· Create a ‘Dynamic Data WebSite’ [A new template came in picture after you install ASP.NET 3.5 Extensions CTP release]

· Add a new LINQ to SQL data model to your project (right-click->add new item->LINQ to SQL Classes item).

Object Relational Mapper:

· LINQ to SQL is an O/RM (object relational mapper) that ships in .NET 3.5, and which allows you to model a relational database using .NET classes.

· You can then query the database using LINQ, as well as update/insert/delete data from it.

· LINQ to SQL fully supports transactions, views, and stored procedures.

· It also provides an easy way to integrate data validation and business logic rules into your data model.

· Scaffolding - Enable Dynamic Templates in Your Project:

· ASP.NET Dynamic Data projects provide built-in support for creating automatic "scaffolding" views of your LINQ to SQL and LINQ to Entities data models.

· Dynamic Data projects include template pages and user controls that can automatically create built-in Data Browsing/Editing/Selection/Deleting Ui That Is Dynamically Constructed At Runtime based on the LINQ to SQL or LINQ to Entities data model you've added to your project.

· To enable this auto-scaffolding support, open the web.config file of your project, search for the "dynamicData" section within it, and set the "enableTemplates" attribute to "true":


<dynamicData dataContextType=”” enableTemplate=”True”>


· Now the last step – Hit F5. You'll by default be taken to a default.aspx page that lists all of the table objects in your data model.

Thanks & Regards,

Arun Manglick || Tech Lead

No comments:

Post a Comment