Databases Reference
In-Depth Information
developer-friendly. In others cases, creating a custom property in the business model to
implement presentation logic can be a reasonable compromise compared to creating a
new custom page, which is almost certainly a bigger investment in terms of effort and
code size.
Out of the box, Dynamic Data does not allow you to take advantage of custom entity
properties. The next section discusses how to overcome this limitation.
Implementing Support for Custom Properties
The Dynamic Data metadata API discussed in Chapter 7 does support custom properties.
In particular, the MetaColumn class has a property called IsCustomProperty , which returns
true when the entity property the column represents was not defined in the .EDMX or
.DBML file. The trouble, however, is that Dynamic Data does not create MetaColumn
objects for custom properties. Figure 13.4 shows a screenshot of the metadata page for the
Product entity. Notice that the Country property is missing from the list of columns on
the right even though it was already defined in the class.
FIGURE 13.4 Default metadata of the Product entity does not include custom properties.
Chapter 7 briefly touched on the fact that Dynamic Data relies on metadata providers to
extract the information about entities and properties from the underlying framework,
such as the Entity Framework or LINQ to SQL. The reason custom properties are not avail-
able through the meta-model API is that the built-in providers do not supply them. By
extending the built-in metadata providers, you can help Dynamic Data recognize the
 
 
Search WWH ::




Custom Search