Databases Reference
In-Depth Information
FIGURE 13.3
Product list page with extended filter lookup algorithm.
Although using this convention-based algorithm to automatically display appropriate
filter templates for all entity properties is more consistent with the overall scaffolding
functionality of Dynamic Data, it does change its default behavior. Whereas earlier you
had to apply a
FilterUIHintAttribute
to
enable
filter generation, you now have to apply
the
DisplayAttribute
and set its
AutoGenerateFilter
property to
false
to
disable
it. Here
is how to prevent a default filter from being generated for the
ProductName
property of the
Product entity:
[MetadataType(typeof(Metadata))]
partial class Product
{
private abstract class Metadata
{
[Display(AutoGenerateFilter = false)]
public object ProductName { get; set; }
}
}
NOTE
The built-in filter scaffolding algorithm is closer to an opt-in model, whereas the replace-
ment implements an opt-out model.