Resolution While Operating Within a Workspace
If you are operating within a workspace, the repository engine returns the version of the object that is present in the workspace. If the repository engine cannot return the in-workspace object to you, it returns an error. The repository engine may fail to return an in-workspace version of the object you requested in the following situations:
- If the workspace contains no version of the requested object, the repository engine returns an error.
- If the workspace contains a version other than the specific version you explicitly requested, the repository engine returns an error.
- If you navigate to a target object along a relationship that is a member of a relationship collection, but the specific version of the target object in your workspace is not among the specific versions of the target object that participate in the relationship, the repository engine returns an error.
For example, the following figure shows one item in the collection Persons-of-V3-of-Main. The target object of the item is Christoph. Because you have not yet navigated along the relationship, the figure does not show which particular version of Christoph will be returned to you; it shows only that it will be Version 2-of-Christoph or Version 3-of-Christoph.
If you are operating in a workspace that contains Version 1-of-Christoph, the repository engine returns an error. When you invoke the get_Target method of the IRelationship interface, the repository engine cannot find a suitable version of Christoph to return to you. It cannot return Version 1 because Version 1-of-Christoph is not related to the source of the navigation. It cannot return Version 2 or Version 3 because neither Version 2-of-Christoph nor Version 3-of-Christoph is in the workspace in which you are operating. (The workspace contains object versions and a workspace can contain only one version of each object.)
In your programs, you can avoid this error by manipulating target object collections rather than relationship collections. This error occurs only when a collection includes an item that the repository engine cannot resolve to an in-workspace object. The only situation in which this occurs is described in the preceding example: the collection is a relationship collection, and none of its items refers to the specific version of the target object that is in the workspace. When you establish a target object collection, however, each item in the collection is a repository object (rather than a relationship to a repository object). If you establish the collection while operating within a workspace, each item in the collection is a version of the target object that is present in the workspace.