Databases Reference
In-Depth Information
LINQ to SQL natively supports only one-to-many relationships and requires you to have
an explicit many-to-many entity in the model. However, it is possible to mimic many-to-
many relationships by implementing a simple coding pattern as Eric Smith and
Shannon Davidson describe in the article published on the Code Project, which can be
found at the following location online:
http://www.codeproject.com/KB/linq/linq-to-sql-many-to-many.aspx
It is possible to create Dynamic Data many-to-many field templates for LINQ to SQL
based on this approach. However, this exercise is outside the scope of this chapter.
ManyToMany_Edit
The ManyToMany_Edit.ascx field template is used for many-to-many children columns in
Edit and Insert modes. This template contains a CheckBoxList control that generates a
check box for every entity the user can check to add it to the list of children.
MultilineText_Edit
The MultilineText_Edit.ascx field template is used for long string columns in Edit and
Insert modes. It contains a TextBox control with TextMode property set to MultiLine . It
also contains a RequiredFieldValidator , used to enforce values for columns marked with
the RequiredAttribute , a RegularExpressionValidator , used to enforce regular expres-
sion patterns for columns marked with the RegularExpressionAttribute and a
DynamicValidator , used to enforce all other validation attributes applied to the column.
String columns are considered long when they do not have maximum length specified in
the data model, such as the Notes column of the Employee entity in the Northwind
sample, which has type NTEXT . You can also force Dynamic Data to use the
MultilineText_Edit field template for columns that do have maximum length by apply-
ing the DataType(DataType.MultilineText) attribute to their properties in the data
model.
Text
Due to the data type fallback used during template lookup, the Text.ascx field template
can be used in Read-only mode for columns of all primitive types with the exception of
Boolean and DateTime columns, for which Dynamic Data provides specific templates. This
field template includes a Literal control that displays the field value converted to a string.
 
Search WWH ::




Custom Search