ASP.NET Dynamic Data Overview (Preview)
Introduction
ASP.NET Dynamic Data provides the Web application scaffolding that enables you to build rich data-driven Web applications. This scaffolding is a mechanism that enhances the functionality of the existing ASP.NET framework by adding the ability to dynamically display pages based on the data model of the underlying database, without having to create pages manually. Dynamic Data infers the table to display and the view to create from the URL of the request. This mechanism is very flexible. It provides a view of the data based on default templates, while enabling complete customization. You can customize the display for a specific table or for the Web application as a whole.
The dynamic data fields are user controls that render standard data field types. You can create custom dynamic data fields for your own rendering needs.
ASP.NET Dynamic Data provides the following features to support the rapid development of data-driven Web applications:
-
Built-in Web application infrastructure to support the creation of a data-driven Web applications without having to create pages or control code. This scaffolding includes the following elements:
-
A data model that you generate by using the Object-Relational Mapping (ORM) designer. The designer generates the classes that model the underlying database.
-
Page templates that are used by the scaffolding to provide the default views of data.
-
Dynamic Data fields for rendering individual data types.
-
Data-model attributes that enable you to customize rendering.
-
Built-in data validation based on the database schema.
-
Dynamic Data configuration settings that you can customize in the Web.config file.
-
Seamless integration with existing ASP.NET data controls for customization. This enables you to adopt an incremental development process while migrating toward adoption of the Dynamic Data controls.
ASP.NET Dynamic Data renders database data automatically. It obtains basic information about the rendering of the data fields from the database metadata. Dynamic Data also provides the capability to add information to the metadata through the database model. This additional information is used for custom validation and data-field rendering.
Data Model
ASP.NET Dynamic Data uses a data model that contains a set of classes to interact with the underlying database. The data model enables validation of user input to be moved to the data layer and removed from the presentation layer. It also automatically generates the rendering for controls based on the underlying data types.
The data model contains a set of classes that represent the database and that are generated through the ORM designer. In Visual Studio 2008, you can use the LINQ to SQL Classes template to generate these classes.
LINQ to SQL Classes is an ORM implementation in the .NET Framework that enables you to model a relational database by using .NET Framework classes. ASP.NET Dynamic Data queries the database using LINQ and uses it to perform update, insert, and delete data operations. This provides an easy way to integrate data validation and business logic rules into your data model.
You can see the classes generated by the ORM designer. After generating the classes in the designer, in the App_Code folder, open the Databasename.designer.vb or Databasename.designer.cs file, where Databasename refers to the name of the modeled database.
Validation
Dynamic data provides built-in data validation based on the database schema. Dynamic Data can perform the following types of validation checks:
-
Required-field validation. If a database field cannot be null, ASP.NET Dynamic Data requires that a value be provided for the field.
-
Length validation. If a database field is a string, ASP.NET Dynamic Data enforces the maximum length of the field.
-
Type validation. If a database field is a DateTime, decimal, double or integer type, ASP.NET Dynamic Data enforces that the value provided matches the database field type.
You can also add your own validation by customizing ASP.NET Dynamic Data.
Customizing ASP.NET Dynamic Data
You can customize ASP.NET Dynamic Data in the following ways:
The following table lists ASP.NET Dynamic Data namespaces.
|
Namespace
|
Description
|
|
System.Web.DynamicData
|
Contains classes that provide the core functionality for ASP.NET Dynamic Data. It also provides extensibility features to customize dynamic data behavior.
|
Additional Information
Suggestions for additional exploration include the following:
This topic is ASP.NET Extensions documentation and is unsupported by Microsoft. Blank topics are included as placeholders and existing content is subject to change in future releases.