Databases Reference
In-Depth Information
Presentation Logic Support
Support for presentation logic is, by far, the biggest part of the public interface exposed by
the
MetaTable
class. Here are the important members to consider:
public virtual IEnumerable<MetaColumn> GetScaffoldColumns(
DataBoundControlMode mode, ContainerType containerType);
The
GetScaffoldColumns
method is responsible for returning the list of columns that will
be displayed by the default page templates. The
containerType
parameter specifies
whether the columns are needed for a single item view or a list. The
mode
parameter speci-
fies whether the current entity is displayed in
ReadOnly
,
Insert
, or
Edit
mode.
public virtual IEnumerable<MetaColumn> GetFilteredColumns();
The
GetFilteredColumns
method is used by the
QueryableFilterRepeater
control, which
generates the filter controls in the List and ListDetails page templates.
public string GetActionPath(string action);
public string GetActionPath(string action, IList<object> primaryKeyValues);
public string GetActionPath(string action, object row);
public string GetActionPath(string action,
RouteValueDictionary routeValues);
The
GetActionPath
method is used whenever a hyperlink is needed to a dynamically
generated page, which includes the
DynamicHyperLink
control as well as the read-only
ForeignKey field template. In the simplest form, this method takes a single action parame-
ter, which can be any string, but typically comes from one of the strings defined in the
static
PageAction
class—
Insert
,
Edit
,
Details
, or
List
. The remaining overloads of the
GetActionPath
method are used to specify additional parameter values in the query string.
This could be limited to just the primary key values of a particular row when generating a
link to a single-item page or any column values when generating a link to a prefiltered list
page.
public IList<object> GetPrimaryKeyValues(object row);
The primary key values can be extracted from a row (an entity instance) using the
GetPrimaryKeyValues
method. This is how the
GetActionPath
overload that takes a row
object works.
public IDictionary<string, object> GetColumnValuesFromRoute(
HttpContext context);
public DataKey GetDataKeyFromRoute();