Databases Reference
In-Depth Information
NOTE
The MVC design pattern should not be confused with the ASP.NET MVC framework . The
ASP.NET MVC framework is simply one of many possible implementations of the MVC
pattern. The MVC framework is neither superior to other implementations, nor is it
required to use to reap the benefits of the MVC pattern. Both the MVC framework and
the approach described here are simply different tools that you can choose to solve
various problems.
Summary
Custom entity templates are ideal for implementing form layout when you want to
provide the best possible user interface for a particular entity in your data model.
Unfortunately, the entity template lookup rules combined with the built-in implementa-
tion of the dynamic entity templates forces you to create at least two versions of each
custom template to implement a particular form layout in Edit, Insert, and Read-only
modes. By combining the built-in dynamic entity templates in a single, multimode
Default.ascx template, you enable creation of custom entity templates that support
multiple modes as well and significantly reduce the amount of effort required to implement
and maintain custom templates in general. A simple custom control, UnleashedLabel , can
be created to display field labels based on the metadata information and avoid hard-
coding it in custom entity templates.
Custom field templates are the best way to implement unique presentation requirements
for a particular entity property, such as the Region property, one of several properties that
store address information. You can configure public properties of both custom and
general-purpose field templates declaratively by specifying custom attributes for the
DynamicControl in template markup and programmatically by handling the Load event of
the DynamicControl .
The best place to implement interaction between field templates, such as the filtering of
the list of Regions based on the Country value entered by the user, is in custom entity
templates. This helps to maximize reuse of field templates and makes it easier to under-
stand and maintain dependencies between field templates in the long term. The built-in
implementation of DynamicControl and FieldTemplateUserControl classes provided by
Dynamic Data requires accessing internal implementation details of individual field
templates to determine the current field values and detect their changes. With simple
extensions of these classes, such as the UnleashedControl and UnleashedFieldTemplate
provided in the sample solution, you can improve encapsulation of the field template and
make accessing field values easier.
 
 
Search WWH ::




Custom Search