Databases Reference
In-Depth Information
}
}
return query;
}
Out of the box, Dynamic Data applications use the GetQuery method of the MetaTable
class in the implementation of the foreign key templates (both field and filter) as well as
in the many-to-many field template. So when users open the DropDownList generated by
the ForeignKey filter template, they will only see those records from the parent table that
were returned by the GetQuery method provided. You can see how the Customer filter
control looks in Figure 14.8 when a customer, Alfreds Futterkiste in this example, accesses
it. Notice that the drop-down list contains only one item.
FIGURE 14.8 Orders List page with the customer filter showing GetQuery results.
Unfortunately, the page templates, such as the List template in the last screenshot, do not
use the GetQuery method. Even though the foreign key filter list might be correct, the
page itself still displays all records. If you take a closer look at the Ship Name column in
Figure 14.8, you notice that it lists orders shipped to various customers, not just the
Alfreds Futterkiste the GetQuery method returns for the current user of the application.
NOTE
Neither EntityDataSource nor LinqDataSource controls allow replacing the default
logic for creating queries. This is a bit surpising because both of these controls define
a ContextCreating event. The dynamic page templates handle this event to have the
data source control use the context object returned by the metadata API, or more
specifically, the CreateContext method of the MetaTable class. The absence of a
similar QueryCreating event might explain why the GetQuery method is ignored by
Dynamic Data out of the box.
Search WWH ::




Custom Search