Databases Reference
In-Depth Information
The
MetaChildrenColumn
class is another specialized descendant of the
MetaColumn
class
that represents one-to-many and many-to-many navigation properties. In one-to-many
relationships,
MetaChildrenColumn
is the opposite of the
MetaForeignKeyColumn
. For
example, the Supplier entity of the Northwind data model has a one-to-many property
called Products, which returns all products a particular supplier offers.
public MetaTable ChildTable { get; }
The
ChildTable
property of the
MetaChildrenColumn
class returns a
MetaTable
object
describing the child entity referenced by the navigation property. For the Products prop-
erty of the Supplier entity, the child entity is Product and the
ChildTable
property of the
MetaChildrenColumn
object would return the Products
MetaTable
.
public bool IsManyToMany { get; }
The
IsManyToMany
property returns
true
if the column represents a many-to-many rela-
tionship and
false
if the relationship is one-to-many. In the Northwind data model,
the Employee entity has a many-to-many relationship with Territory, and the
MetaChildrenColumn
instance describing the Territories column has the
IsManyToMany
property set to
true
.
NOTE
LINQ to SQL does not support many-to-many associations natively. The
IsManyToMany
property is always false for columns describing LINQ to SQL data models.
public MetaColumn ColumnInOtherTable { get; }
The
ColumnInOtherTable
property of the
MetaChildrenColumn
class returns a
MetaColumn
object that represents the opposite end of the association. For the Products property of the
Supplier entity, this property returns a
MetaColumn
that represents the
Supplier
property
of the Product entity.
This property can return a
MetaForeignKeyColumn
object if the children column represents
a one-to-many navigation property, such as the Products property of the Supplier entity,
whose counterpart is the Supplier property of the Product entity. It can also return a
MetaChildrenColumn
object if the children column represents a many-to-many navigation
property, such as the
Territories
property of the Employee entity, whose counterpart is
the
Employees
property of the Territory entity. This property can also return
null
if the
navigation property represents a one-way association, or in other words, when the chil-
dren navigation property doesn't have a counterpart on the other side.
public string GetChildrenPath(string action, object row);
public string GetChildrenPath(string action, object row, string path);