Retaining Workspace Context
As you navigate the objects present in the workspace, the repository engine retains the workspace context. In other words, if you retrieve an item from a relationship collection or a target object collection, the retrieved target item has the same context as the source item of that relationship.
However, only relationship collections and target object collections retain workspace context. If you retrieve an item from any VersionCol object, the reference that the repository engine returns to you has the context of the open repository instance in which you are operating. The object reference does not have an in-workspace context.
For example, suppose that within the context of a workspace, you have a reference to the root object, and you perform these steps:
- From the root object, you navigate to a particular repository object.
As you navigate to each object along the navigation path, the repository engine returns whichever object version is present in the workspace. At each step, the reference that the repository engine returns preserves the workspace context.
- At some point along the navigation path, you materialize the PredecessorVersions collection of an object version. Then, you retrieve the first item in that collection.
The repository engine returns a reference to the oldest predecessor of the object version. Because the PredecessorVersions collection is a VersionCol object rather than a relationship collection or a target object collection, this reference does not preserve the workspace context. All subsequent manipulations of and navigations from this object occur within the general context of the open Repository instance.