Introduction to ASP.NET Dynamic Data
ASP.NET Dynamic Data brings major usability and RAD development changes to the existing
ASP.NET data controls. RAD development is significantly increased by the use of
a rich scaffolding framework. After you add a LINQ to SQL or Entity Framework data
model to a project, you can simply register it with Dynamic Data. The result is
a fully functional Web site. Full CRUD (create, read, update, and delete) operations
are supported. The site includes filtering by foreign keys and Boolean fields; foreign
keys are automatically converted to their friendly names. Smart validation is automatically
available, which provides validation based on database constraints for nullable
fields, data type, and field length.
The DetailsView and GridView controls have been extended to display
fields by using templates instead of by using hard-coded rules that are programmed
in the controls. These templates are part of the project, and you can customize
them to change their appearance or to specify which controls they use for rendering.
This makes it very easy to make a change in one place in your site that specifies
how to present dates for editing, as one example. FormView and ListView
controls can implement similar behavior by using a DynamicControl object
in their templates and by specifying which field in the row to display. Dynamic
Data will then automatically build the UI for these controls based on the templates
that you specify.
Validation is significantly improved in the controls as well. The controls read
metadata for a LINQ to SQL or Entity Framework data model and provide automatic
validation based on the model. For example, if a column in the database is limited
to 50 characters, and if a column is marked as not nullable, a RequiredFieldValidator
control is automatically enabled for the column. (The controls also automatically
support data-model-level validation.) You can apply other metadata to take further
control over display and validation.
The RTM version of Dynamic Data and Entity Framework have a naming mismatch that can cause some errors with some types of data relationships. A workaround is available which provides a fix for 1->0..1 and *->1 relationships which may generate error messages similar to "'System.Web.UI.WebControls.EntityDataSourceWrapper' does not contain a property with the name 'Orders.OrderID'". This fix replaces the default Entity Framwork Data Model provider for Dynamic Data with a new data model provider that works around these issues. The Entity Framework workaround can downloaded here.