Databases Reference
In-Depth Information
represented by a field or filter control on a page and how the template for that control is
selected.
public virtual bool Scaffold { get; set; }
The
Scaffold
property of the
MetaColumn
class determines whether Dynamic Data will gener-
ate a field template for the entity property it represents. By default,
Scaffold
returns
false
for automatically generated, custom, and primitive properties that are a part of a foreign key.
You can change the default value of this property by applying the
ScaffoldColumnAttribute
or the
DisplayAttribute
with the
AutoGenerateField
property value specified.
public virtual string UIHint { get; }
The
UIHint
property of the
MetaColumn
class returns the name of a field template that
Dynamic Data tries first when generating a control for the entity property. The
UIHint
property returns a blank string unless you apply the
UIHintAttribute
to the entity prop-
erty in code.
public DataTypeAttribute DataTypeAttribute { get; }
The
DataTypeAttribute
property returns the
DataTypeAttribute
that was applied to the
entity property in code. The
UIHint
and data type take precedence over the more generic
template names based on .NET types that Dynamic Data tries when searching for an
appropriate field template.
public string FilterUIHint { get; }
The
FilterUIHint
property is similar to the
UIHint
but specifies the name of a
filter
template. It also returns a blank string by default and can be specified by applying the
FilterUIHintAttribute
to the entity property. Dynamic Data uses filter hints when gener-
ating filter controls, typically as part of a
QueryableFilterRepeater
in the List page
template.
public bool AllowInitialValue { get; }
The
AllowInitialValue
property of the MetaColumn determines whether the entity prop-
erty can have a value entered in Insert mode. The
AllowInitialValue
returns false for gener-
ated and read-only properties. You can also override it by applying the
EditableAttribute
to
the entity property in code with the
AllowInitialValue
specified.
Business Logic Support
Several properties of the
MetaColumn
class provide support for business logic based on data
annotations. This number is surprisingly small, as it covers only three of the attributes
discussed in Chapter 3, “Field Templates.”
public object DefaultValue { get; }