Databases Reference
In-Depth Information
FIGURE 6.7
Dynamic Delete page.
The page templates discussed so far are
dynamic
, meaning they can generate web pages for
any entity type in your data model. Thanks to the rich metadata information provided by
Dynamic Data in the form of a
MetaTable
object, a single generic page template can
handle a particular type of action, such as List or Details, for any entity type. The gener-
ated web pages vary depending on the properties of the entity type, but the variations are
limited to the order of fields on the form, their labels, and data entry controls. When the
user interface cannot be implemented by creating a custom entity template, developers
can create
custom
page templates to implement unique functionality required for a partic-
ular entity type.
Consider the Orders table in the Northwind sample database. It stores order header infor-
mation, such as Order Date, Customer, Shipper, and so on. However, the order items are
stored in a separate table called Order Details. In the sample data model, these tables are
represented by the
Order
and
Order_Detail
classes, respectively. Intuitively, an
Order_Detail
instance is
a part of
the parent Order instance and cannot be entered inde-
pendently. This is different from how the Order and Customer instances relate to each
other: An Order is
associated with
a Customer and can be entered independently.
Unfortunately, Dynamic Data cannot distinguish between these types of relationships
automatically and has to assume that the
Order_Detail
is an independent entity type. As
a result, the default experience for viewing orders is rather cumbersome because it requires
users to switch between the Order details page and the Order_Detail List page shown in
Figure 6.8.