Databases Reference
In-Depth Information
FIGURE 6.10
Page template lookup algorithm.
A Dynamic Data web application first uses the registered URL routes to determine the
Table
and the
Action
names. When the matching route is found, unless it provides an
explicit
ViewName
, the
Action
name is used instead to identify the name of the page
template.
Having determined both
Table
and
ViewName
from the matching route, Dynamic Data
first tries to find a matching
custom
page template in a subfolder with the name of the
table inside of the
DynamicData\CustomPages
. If a custom template exists, it is immedi-
ately used to handle the incoming web request.
If a matching custom page template does not exist, Dynamic Data then tries to find a
dynamic page template in the
DynamicData\PageTemplates
folder of the web application.
If neither custom nor dynamic page template with the matching
ViewName
can be found,
an HTTP error 404 (Resource cannot be found) is returned back to the user.
Page templates are responsible for generating web pages that perform CRUD and other
generic actions. A single set of page templates can be reused to implement operations for
multiple entity types. Out of the box, Dynamic Data web application projects come with
page templates for inserting, editing, displaying, and searching for entities of any type.
New dynamic page templates can be created to support additional action types, such as
deleting an entity.
A page template implements most of the data access and some of the presentation logic
required by a dynamic page. Dynamic Data relies on the information provided by ASP.NET
routing to determine which page template to use and for which entity type it needs to