Scaffolding Concept In ASP.NET


Scaffolding, is a way to automatically generate Web pages for each table in the database. Scaffolding lets you create a functional Web site for viewing and editing data based on the schema of the data. You can easily customize scaffolding elements or create new ones to override the default behavior.

Scaffolding is a technique supported by some model-view-controller frameworks, in which the programmer may write a specification that describes how the application database may be used. The compiler uses this specification to generate code that the application can use to create, read, update and delete database entries, effectively treating the template as a “scaffold” on which to build a more powerful application.

ASP.NET Dynamic Data

ASP.NET Dynamic Data is a Ruby on Rails-inspired web application scaffolding framework from Microsoft, shipped as an extension to ASP.NET. ASP.NET Dynamic Data lets you create extensible data-driven Web applications by inferring at run time the appearance and behavior of data entities from the database schema and deriving UI behavior from it. It exposes tables in a database by encoding it in the URI of the ASP.NET web service, and the data in the table is automatically rendered to HTML. The process of rendering can be controlled using custom design templates. Internally, it discovers the database schema by using the database metadata.

ASP.NET Dynamic Data was originally shipped as part of the “ASP.NET 3.5 Extensions” package in 2007, and was incorporated into the .NET Framework 3.5 Service Pack 1, which was released August 11, 2008.

Dynamic Data obtains data schema information or metadata from a data model that represents database entities as common language runtime (CLR) types. The following illustration shows the Dynamic Data architecture. The dashed-line boxes represent technologies that are defined in the CLR but that are used by Dynamic Data.

Dynamic Data Architecture

Dynamic Data Architecture

As the illustrations shows, Dynamic Data architecture contains the following layers:

  • Presentation layer, which contains elements that are used to create the UI for displaying and editing data entities.
  • Data layer, which contains the data model that represents the database entities as CLR types.
  • Data source mapping layer, which contains elements that are part of the CLR but are used by Dynamic Data. These elements are technologies such as LINQ to SQL and ADO.NET Entity Framework that are used to generate data models.

How to Use Dynamic Data

Dynamic Data supports the following design options:

  • Create a Web site using scaffolding. You can create a basic Web application that uses ASP.NET Dynamic Data that requires little or no coding. When scaffolding is enabled, ASP.NET analyzes the data model and generates Web pages dynamically based on the metadata information. These auto-generated Web pages provide CRUD capabilities for each table.
  • Enable dynamic behavior for individual data-bound controls (such as the GridView and ListView controls) in an existing ASP.NET Web site. This enables you to use Dynamic Data features such as run-time data field validation, predefined pages to perform CRUD operations, and data field customization.
  • Add Dynamic Data features to an existing (or new) ASP.NET Web site. You can have an existing Web site and add Dynamic Data features and scaffolding elements to it. Here you do not enable Dynamic Data for specific data-bound controls; instead, you import scaffolding elements. This approach gives you more control over customization than enabling dynamic behavior for individual controls.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s