INamedObject Interface

See Also

Normally, a name is associated with a Repository object through a naming relationship. The collection for such a relationship provides the scope for the name, and can require that all names in the collection be unique. This is the preferred method for naming objects, when a given object will be the destination of only one naming relationship.

If your information model contains a class that is not the destination of a naming relationship type, or is the destination of multiple relationship types, but no single relationship type is the obvious choice to be the naming relationship type, you can attach the name property to the class. This is accomplished by defining your class to implement the INamedObject interface. If your class implements the INamedObject interface, the Repository engine will use that interface when asked to retrieve or set an object name.

When to Use

Use the INamedObject interface to access the Name property of a Repository object that exposes this interface.

Properties

Property Description
Name The name of the object.

Methods

IUnknown Method Description
QueryInterface Returns pointers to supported interfaces.
AddRef Increments the reference count.
Release Decrements the reference count.

IDispatch Method Description
GetIDsOfNames Maps a single member and a set of argument names to a corresponding set of dispatch identifiers.
GetTypeInfo Retrieves a type information object, which can be used to get the type information for an interface.
GetTypeInfoCount Retrieves the number of type information interfaces that an object provides (either 0 or 1).
Invoke Provides access to properties and methods exposed by an Automation object.

IrepositoryDispatch Method Description
get_Properties Retrieves the IReposProperties interface pointer. The IreposProperties interface provides access to the persistent members exposed by the InamedObject interface.

Remarks

None of the standard Repository engine or Type Information Model classes implement the INamedObject interface. However, the Repository engine does use the INamedObject interface, if it is exposed by a Repository object.

When the IRepositoryItem::get_Name method is invoked for a Repository object, the Repository engine will perform these steps to retrieve the name:

  1. If the object exposes the INamedObject interface, the Repository engine returns the value of the Name property on the INamedObject interface.

  2. Otherwise, the Repository engine searches for a naming relationship for which the current object is the destination object, taking the workspace context into consideration.

  3. If such a relationship is found, the Repository engine returns the name associated with that relationship.

  4. If the object is not the destination of a naming relationship, the Repository engine returns a null name.

When the IRepositoryItem::put_Name method is invoked for a Repository object, the Repository engine will perform these steps to set the name:

  1. The Repository engine sets the value of the Name property of all naming relationships for which the object is the destination.

  2. If the object exposes the INamedObject interface, the Repository engine also sets the value of the Name property attached to that interface.