ArcObjects Library Reference (GeoDatabase)  

IRelationshipClassEvents.OnCreate Event

This event is fired when a new relationship is created in the relationship class.

[Visual Basic .NET]
Public Event OnCreate As OnCreateEventHandler
[C#]
public event OnCreateEventHandler OnCreate
[C++]
HRESULT OnCreate(
  IRelationship* rel
);
[C++]

Parameters

rel [in]

  rel is a parameter of type IRelationship

Product Availability

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

Description

OnCreate is fired if you create a new simple or attributed relationship in one of the following ways :

Note that if you call IRelationshipClass::CreateRelationship on a simple relationship this changes the foreign key inside the destination object to point to the new origin object : i.e the old relationship is deleted in creating the new relationship.  No OnDelete event will be fired corresponding to this implicit deletion.  An application may be interested in the details of the relationship that was implicitly deleted.  This can be achieved by getting the ISimpleRelationshipChanges interface on the Relationship object passed in to the OnCreate event.  This interface has a single property OldOriginKey that the application can use to get the key of the origin object.  Any further fetching of the old origin object is up to the application using this key.

Note that one can also create and delete relationships implicitly by directly using put_Value to set the origin foreign key field inside the destination object in the case of a simple relationship class.   However, no events in IRelationshipClassEvents will be fired if the user does this (for eg. uses the Table document to directly set foreign key values in the destination object).

See Also

IRelationshipClassEvents Interface