Reldef Table: Relation Definition Metadata
The reldef table contains metadata that defines a relation between two classes. The OLE DB provider for Commerce Server 2009 uses metadata from the reldef table and other metadata to store instances of user classes in the database.
You must define metadata for the parent and child classes before you define the metadata for a relation between the classes.
To link two classes, the ParentClassName of the relation must be set to the ClassDefName of the parent Class object. Also, the ChildClassName of the relation must be set to the ClassDefName of the child Class object. To link a data member that is not a key in the parent class together with a data member in the child class, create a relation member that identifies the data members to link. For more information about relation members, see Relmemdef Table: Relation Member Definition Metadata.
For information about how to create a new relation between two existing classes, see Creating a New Class Relation.
The Relation definition metadata contains an attribute that defines the type of the relation (RelType). The following table contains the valid relation types and the corresponding type codes.
Relation Type |
Code |
Description |
---|---|---|
One-to-many |
2 |
Each parent has zero or more children; each child has one parent. The identifier ("Classname" ID) of the parent is used as a foreign key by the child. |
Many-to-many |
3 |
Each parent has zero or more children; each child has one or more parents. |
One-to-many with inheritance |
194 |
Same as one-to-many except all members of the parent are visible to the children. (By default, in a regular one-to-many relation, only the key members of the parent class are visible.) |
The following table describes the columns in the reldef table. There is a row in the reldef table for each relation that is defined.
Column name |
Type |
Allow null |
Requirement |
Description |
---|---|---|---|---|
RelationID |
int |
no |
Leave blank |
Stores the unique identifier for the relation. |
CatalogID |
int |
yes |
Leave blank |
Stores the identifier for the schema catalog. |
CatalogName |
nvarchar (128) |
yes |
Leave blank |
Stores the name of the schema catalog, "DWSchema". |
ChildClassID |
int |
yes |
Leave blank |
Stores the class identifier of the child class for the relation. |
ChildClassName |
nvarchar (57) |
yes |
Required |
Stores the name of the child class for the relation. |
CreatedTime |
datetime |
yes |
Reserved |
Records when the relation was created. |
Description |
nvarchar (128) |
yes |
Optional |
Stores the description of the object. |
DisplayName |
nvarchar (128) |
yes |
Optional |
Stores the display name of the object. |
MajorVersion |
int |
yes |
Reserved |
Stores the major version number for the relation. |
MinorVersion |
int |
yes |
Reserved |
Stores the minor version number for the relation. |
ModifiedTime |
datetime |
yes |
Reserved |
Records when the relation was last modified. |
ParentClassID |
int |
yes |
Leave blank |
Stores the class identifier of the parent class for the relation. |
ParentClassKey |
nvarchar (128) |
yes |
Required |
Stores the name of the key for the parent class. |
ParentClassName |
nvarchar (57) |
yes |
Required |
Stores the name of the parent class for the relation. |
RelationName |
nvarchar (128) |
yes |
Required |
Stores the name of the relation. |
RefMemName |
nvarchar (100) |
yes |
Leave blank |
Reserved. |
RelType |
smallint |
yes |
Required |
Stores the type of the relation. |
Status |
int |
yes |
Reserved |
Reserved. |