This document is archived and information here might be outdated.  Recommended version.


IMemoryRelationshipClassFactory.Open Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (GeoDatabase)  

IMemoryRelationshipClassFactory.Open Method

Opens the memory relationship class specified by the given properties.

[Visual Basic .NET]
Public Function Open ( _
    ByVal Name As String, _
    ByVal originPrimaryClass As IObjectClass, _
    ByVal originPrimaryKeyField As String, _
    ByVal originForeignClass As IObjectClass, _
    ByVal originForeignKeyField As String, _
    ByVal ForwardPathLabel As String, _
    ByVal BackwardPathLabel As String, _
    ByVal Cardinality As esriRelCardinality _
) As IRelationshipClass
[C#]
public IRelationshipClass Open (
    string Name,
    IObjectClass originPrimaryClass,
    string originPrimaryKeyField,
    IObjectClass originForeignClass,
    string originForeignKeyField,
    string ForwardPathLabel,
    string BackwardPathLabel,
    esriRelCardinality Cardinality
);
[C++]
HRESULT Open(
  BSTR Name,
  IObjectClass* originPrimaryClass,
  BSTR originPrimaryKeyField,
  IObjectClass* originForeignClass,
  BSTR originForeignKeyField,
  BSTR ForwardPathLabel,
  BSTR BackwardPathLabel,
  esriRelCardinality Cardinality,
  IRelationshipClass** RelationshipClass
);
[C++]

Parameters Name [in] Name is a parameter of type BSTR originPrimaryClass [in]
originPrimaryClass is a parameter of type IObjectClass originPrimaryKeyField [in] originPrimaryKeyField is a parameter of type BSTR originForeignClass [in]
originForeignClass is a parameter of type IObjectClass originForeignKeyField [in] originForeignKeyField is a parameter of type BSTR ForwardPathLabel [in] ForwardPathLabel is a parameter of type BSTR BackwardPathLabel [in] BackwardPathLabel is a parameter of type BSTR Cardinality [in]
Cardinality is a parameter of type esriRelCardinality RelationshipClass [out, retval]
RelationshipClass is a parameter of type IRelationshipClass

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

The Open method either creates a new MemoryRelationshipClass or returns a reference to an existing MemoryRelationshipClass if that class has already been created.

When creating a MemoryRelationshipClass, much of the same information that is required for a RelationshipClass in the Geodatabase is needed. However, MemoryRelationshipClasses are always simple and non-attributed so only two tables and two fields need to be specified. The originPrimaryKeyField refers to the field in the originPrimaryClass while the originForeignKeyField refers to the field in the originForeignClass.

Once the MemoryRelationshipClass is created, the IRelationshipClass interface can be used to find the tables and fields specified in the Open method. Here is how the properties from IRelationshipClass are mapped to the parameters of the Open method:

IRelationshipClass Property Open method parameter      
DestinationClass originForeignClass
OriginClass originPrimaryClass
OriginPrimaryKey originPrimaryKeyField
OriginForeignKey originPrimaryKeyField
ForwardPathLabel ForwardPathLabel
BackwardPathLabel BackwardPathLabel
Cardinality Cardinality

The diagram below describes the associations that define a MemoryRelationshipClass.

See Also

IMemoryRelationshipClassFactory Interface

.NET Related Topics

Joining data