Databases Reference
In-Depth Information
to appear and give them appropriate names, such as “
Left
”, “
Right
”, “
Bottom
”, and so on.
As long as you use the matching names in the
GroupName
annotations, the
FindGroupPlaceHolder
method will be able to find them, no matter how complex the
form is.
The ability to build user interfaces based on metadata is one of the key advantages
Dynamic Data offers. It dramatically reduces the amount of presentation code you have
to write and maintain over the lifetime of an application and,
when used judiciously
, signif-
icantly increases the speed of development. By postponing implementation of the user
interface, Dynamic Data allows you to focus on the most important part of the applica-
tion—its entity model. You can then refine it through short successive iterations, collect-
ing feedback from business users based on actual working applications instead of
diagrams, and greatly reduce risk and uncertainty in the project.
Out of the box, Dynamic Data offers robust capabilities for building single-column forms
through metadata. The
DisplayAttribute
allows you to control display names and order
of entity properties on forms and in grids. The
DisplayFormatAttribute
offers configura-
tion options to control appearance of values in both Read-only and Edit mode. The
DataTypeAttribute
and the
UIHintAttribute
can be used to override the default rules
Dynamic Data uses when selecting a field template for a particular property. The
EnumDataTypeAttribute
can be applied to an integral property to associate it with a list of
predefined values that are presented to the users as a
DropDownList
control by the
Enumeration field template.
This chapter discussed in detail how to overcome some of the limitations of Dynamic
Data. The Enumeration field templates can be extended to take advantage of the
DisplayAttribute
to specify human-readable display name for enum items. Dynamic
Data controls can be also extended to support field template parameters specified declara-
tively with the
UIHintAttribute
. Although it should be done with great caution, interac-
tion between field templates can be configured through the metadata. Finally, additional
dynamic entity templates can be implemented to take advantage of extended data annota-
tions, such as the
EntityUIHintAttribute
discussed in this chapter.