This Wrox Blox will teach you how to work with the new ASP.NET Dynamic Data feature set. Rather than being a new data access technology or some new approach to querying the database, a Dynamic Data web site helps abstract the user interface controls needed to present the data in your database. You will learn to model the database in LINQ to SQL and apply a variety of metadata attributes to the model. These attributes and their arguments will allow field templates to adapt to the context of the application. Furthermore, this Wrox Blox will teach you how to build specialized user controls called field templates that respond to the metadata information applied to database models. You will see how to push validation rules and custom business logic out of the user interface layer and down to the model layer. Finally, you will learn how to secure scaffolding pages that provide full editing capabilities to your database tables. Table of Contents
Exploring a Dynamic Data Web Site 1
Prerequisites 2
Create the Web Site 2
Building Blocks 6
Understanding Model Metadata 7
Display Name 9
Required 9
Regular Expression 9
String Length 9
UI Hint 9
Range 9
Display Format 10
Scaffold Column 10
Metadata Type 10
Display Column 10
Scaffold Table 10
Building Custom Field Templates 10
Build the URL Field Templates 11
Validating against Custom Business Logic 19
Validate Unique E-Mail Addresses 20
Move the Data Context to a Separate Assembly 22
Secure the Scaffolding 25
Add ASP.NET Membership Services 25
Secure Scaffold Pages 28
Wrapping Up 29
About the Author 30