ArcObjects Library Reference (GeoDatabase)  

MemoryRelationshipClass Class

A relationship class object that is stored in memory.

MemoryRelationshipClass is a non-creatable object. References to non-creatable objects must be obtained through other objects.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Interfaces

Interfaces Description
IDataset Provides access to members that supply dataset information.
IRelationshipClass Provides access to members that return information about the relationship class, create relationships, relationship rules and get related objects.
IRelationshipClass2 Provides access to members that get related object row pairs within a query filter specification.

Remarks

A MemoryRelationshipClass is a type of RelationshipClass in which the origin and destination classes can be from different workspaces and do not need to persist in a geodatabase. For example, the origin class can represent a shapefile while the destination class can represent a table in a personal or File geodatabase. It is stored in memory instead of within a geodatabase like other RelationshipClasses. You can use the MemoryRelationshipClassName object to save and restore a MemoryRelationshipClass.

To create a Relate in ArcMap, a MemoryRelationshipClass must first be created and then assigned to a Layer or StandaloneTable using the IRelationshipClassCollectionEdit interface.

MemoryRelationshipClasses are simple (non-composite), non-attributed RelationshipClasses that do not support relationship rules. When initialized, the notification type is automatically set to esriRelNotificationNone.

MemoryRelationshipClass inherits from a RelationshipClass and although it implements the same interfaces, not all properties and methods are supported. The following is a review of each of these inheritied interfaces and describes which properties and methods behave differently or are not supported with MemoryRelationshipClasses.

IRelationshipClass

The table below describes how the methods and properties from IRelationshipClass are implemented by a MemoryRelationshipClass:

Member Behavior with a MemoryRelationshipClass
DestinationClass Returns the OriginForeignClass object specified in the IMemoryRelationshipClassFactory::Open method.
OriginClass Returns the OriginPrimaryClass object specified in the IMemoryRelationshipClassFactory::Open method.
DestinationForeignKey Returns an empty string since a MemoryRelationshipClass is not attributed.
DestinationPrimaryKey Returns an empty string since a MemoryRelationshipClass is not attributed.
FeatureDataSet Property is not supported. An error will be returned if you try to use this property.
IsAttributed Returns False since it can't be attributed.
IsComposite Returns False since it can't be composite.
Notification Returns esriRelNotificationNone.
RelationshipClassID Returns -1. This does not need to be set to a meaningful value since a MemoryRelationshipClass is not stored in a geodatabase
RelationshipRules Property is not supported. An error will be returned if you try to use this property.
AddRelationshipRule Method is not supported. An error will be returned if you try to use this method.
CreateRelationship Method is not supported. An error will be returned if you try to use this method.
DeleteRelationship Method is not supported. An error will be returned if you try to use this method.
DeleteRelationshipRule Method is not supported. An error will be returned if you try to use this method.
DeleteRelationshipsforObject Method is not supported. An error will be returned if you try to use this method.
DeleteRelationshipsforObjectSet Method is not supported. An error will be returned if you try to use this method.
GetRelationship Method is not supported. An error will be returned if you try to use this method.
GetRelationshipForObject Method is not supported. An error will be returned if you try to use this method.
GetRelationshipForObjectSet Method is not supported. An error will be returned if you try to use this method.
Since the origin and destination classes may belong to different workspaces, the methods in IRelationshipClass that involve editing are not available. The properties and methods of IRelationshipClass that are not listed in the table behave the same way with MemoryRelationshipClasses and they do with other RelationshipClasses.
IDataset
The table below describes how the methods and properties from IDataset are implemented by a MemoryRelationshipClass:
Member Behavior with a MemoryRelationshipClass
BrowseName You can get, but not set the BrowseName. The BrowseName will be the name given the MemoryRelationshipClass when initialized. If you try to set it an error is returned.
Category Returns the string "Memory relationship class"
FullName Returns a MemoryRelationshipClassName object.
Name Like BrowseName, returns the name given the MemoryRelationshipClass when initialized
PropertySet Property is not supported. An error will be returned if you try to use this property.
Subsets Returns a null value.
Type Returns esriDTRelationshipClass.
Workspace Returns a null value.
CanCopy Returns False indicating that it can't be copied.
CanDelete Returns False indicating that it can't be deleted.
CanRename Returns true indicating that it can be renamed.
Copy Method is not supported. An error will be returned if you try to use this method.
Delete Method is not supported. An error will be returned if you try to use this method.
Rename Renames the MemoryRelationshipClass to the name given.

IRelationshipClass2

The IRelationshipClass2 interface provides methods that allow a QueryFilter to be applied to the group of rows that match a specified group of rows in the related table. For example, instead of returning all counties in the state of California, a QueryFilter can be used to limit the California counties returned to just those with a population of over 1 million.