Here's the scaffolding live-cycle, according to David Ebbo:
- Define your model: this step is not specific to Dynamic Data, but this is where it all starts. You have a database, and you create a model for it. Currently, this is done using Linq to SQL. In the future Linq to Entities will be supported as well.
- Test a scaffolded version of your app: with no additional effort, Dynamic Data lets you run a scaffolded web application on top of your schema. Although this scaffold has a 'standard' UI, it lets you try all CRUD operations on your tables. Furthermore, it has full support for relationships. For instance (assuming Northwind), the Products page would let you navigate to a product's category info, and editing a Product's category would show you a rich drop down with category names (instead of IDs).
- Customize the shared page views: you then get to make changes to the page templates that are used to display the scaffolded views. That, you can make changes that will affect the view of all the tables.
- Customize the specific pages: the next step is to define some custom UI for specific pages. e.g. you could write one of Products and another for Categories. The nice thing is that while you do this, you still get the standard scaffolded view for all the other tables. This lets you create specfic pages at your own pace, while keeping a functional application at every point.
- Annotate your model: you can add attributes to your model to add extra knowledge about certain fields. e.g. you could set a Range on the product's UnitsInStock field so it only allows values between 0 and 50. The UI would then automatically pick this up and validate inputs accordingly. The great thing is that you are keeping this information on your model, and don't need to 'pollute' your pages with it.
- Create custom field templates: all fields in Dynamic Data are rendered via field templates, which are basically user controls. You can also create custom templates, which can be very powerful. e.g. in the above case, you could create a field template that renders a range as a slider control instead of a textbox. Again, your page would pick that up without you having to add this custom UI directly in the aspx file.
No comments:
Post a Comment