INamedObject Interface

Meta Data Services Programming

Meta Data Services Programming

INamedObject Interface

Typically, 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 classes implement the INamedObject interface by default. However, the repository engine does use the INamedObject interface, if the interface 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.

See Also

IRepositoryItem get_Name

IRepositoryItem put_Name

Naming and Unique-Naming Collections

Naming Objects, Collections, and Relationships

Workspace Context