This document is archived and information here might be outdated. Recommended version. |
Creates a new relationship class.
[Visual Basic .NET] Public Function CreateRelationshipClass ( _ ByVal relClassName As String, _ ByVal OriginClass As IObjectClass, _ ByVal DestinationClass As IObjectClass, _ ByVal ForwardLabel As String, _ ByVal BackwardLabel As String, _ ByVal Cardinality As esriRelCardinality, _ ByVal Notification As esriRelNotification, _ ByVal IsComposite As Boolean, _ ByVal IsAttributed As Boolean, _ ByVal relAttrFields As IFields, _ ByVal OriginPrimaryKey As String, _ ByVal destPrimaryKey As String, _ ByVal OriginForeignKey As String, _ ByVal destForeignKey As String _ ) As IRelationshipClass
[C#] public IRelationshipClass CreateRelationshipClass ( string relClassName, IObjectClass OriginClass, IObjectClass DestinationClass, string ForwardLabel, string BackwardLabel, esriRelCardinality Cardinality, esriRelNotification Notification, bool IsComposite, bool IsAttributed, IFields relAttrFields, string OriginPrimaryKey, string destPrimaryKey, string OriginForeignKey, string destForeignKey );
[C++]
HRESULT CreateRelationshipClass(
BSTR relClassName,
IObjectClass* OriginClass,
IObjectClass* DestinationClass,
BSTR ForwardLabel,
BSTR BackwardLabel,
esriRelCardinality Cardinality,
esriRelNotification Notification,
VARIANT_BOOL IsComposite,
VARIANT_BOOL IsAttributed,
IFields* relAttrFields,
BSTR OriginPrimaryKey,
BSTR destPrimaryKey,
BSTR OriginForeignKey,
BSTR destForeignKey
);
[C++] Parameters relClassName [in]
relClassName is a parameter of type BSTR OriginClass [in]
OriginClass is a parameter of type IObjectClass* DestinationClass [in]
DestinationClass is a parameter of type IObjectClass* ForwardLabel [in]
ForwardLabel is a parameter of type BSTR BackwardLabel [in]
BackwardLabel is a parameter of type BSTR Cardinality [in]
Cardinality is a parameter of type esriRelCardinality Notification [in]
Notification is a parameter of type esriRelNotification IsComposite [in]
IsComposite is a parameter of type bool IsAttributed [in]
IsAttributed is a parameter of type bool relAttrFields [in]
relAttrFields is a parameter of type IFields* OriginPrimaryKey [in]
OriginPrimaryKey is a parameter of type BSTR destPrimaryKey [in]
destPrimaryKey is a parameter of type BSTR OriginForeignKey [in]
OriginForeignKey is a parameter of type BSTR destForeignKey [in]
destForeignKey is a parameter of type BSTR
If your application/site is not appropriately licensed, CreateRelationshipClass can return an error of FDO_E_NO_SCHEMA_LICENSE.
The CreateRelationshipClass method can be used to create a new stand-alone relationship class that is not part of a feature dataset. The relationship class is implemented as a separate data table whose name is the name of the relationship class if the cardinality is many-to-many or if the relationship class is attributed. The relAttribFields parameter is optional, and a null value may be passed in for non-attributed relationship classes.
Many-to-many or attributed relationship classes require specification of all four key fields�the OriginPrimaryKey and the destPrimaryKey parameters are the primary key fields for the origin and destination object classes. The OriginForeignKey and destForeignKey parameters are the names of the corresponding foreign keys that will be created in the data table representing the relationship class. If the relationship class is one-to-one or one-to-many and not attributed, then the relationship class is implemented as a foreign key field in the destination object class (the OriginForeignKey) that references the primary key field in the origin object class (the OriginPrimaryKey). In this case, the OriginPrimaryKey, the OriginForeignKey, and the destPrimaryKey must be supplied.
The Fields object passed to the relAttrFields parameter should not be an object retrieved from another class. If the new class is going to have the same fields as an existing class, cast the existing class' fields collection to the IClone interface, clone it, and use the cloned fields collection as input for this method.