IRepositoryObjectVersion::MergeVersion
See Also
Changes the current object version by combining its property values and origin collections with the property values and origin collections of another version of the same object.
HRESULT MergeVersion(
IRepositoryObjectVersion *pOtherVersion
long fFlags
);
Parameters
- *pOtherVersion
- [in]
The IRepositoryObjectVersion interface pointer for the predecessor of the merge — the object version whose property values and collections should be merged into the current version.
- fFlags
- [in]
Indicates which object version is the primary and which is secondary in the merge.
Return Value
S_OK
The method completed successfully.
- Error
- Values
This method failed to complete successfully.
Remarks
Relationships are inserted at the end of the sequenced collection.
The two object versions must be versions of the same object.
The current object version must be unfrozen. The other object version must be frozen.
MergeVersion compares the property values and collections of each object version to a third version, called the Basis Version.
Microsoft® Repository considers one of the two to-be-merged object versions to be the primary version, and the other to be the secondary version, according to the value of fFlags you supply. During the merge, Repository considers each property and origin collection type in turn. For each property, MergeVersion uses this rule:
- If the primary version differs from the Basis Version, the Repository uses the property value from the primary version. If only the secondary version differs from the Basis Version, Repository uses the property value from the secondary version. If neither version differs from the Basis Version, Repository leaves the property value in the current version unchanged.
For each origin collection type whose COLLECTION_MERGEWHOLE flag is set, MergeVersion uses this rule:
- If the primary version's collection differs (see Comparing Collections) from the Basis Version's collection, Repository uses the collection from the primary version. If only the secondary version's collection differs from the Basis Version's, the Repository uses the collection from the secondary version. If neither version differs from the Basis Version, Repository leaves the property value in the current version unchanged.
For each origin collection type whose COLLECTION_MERGEWHOLE flag is not set, MergeVersion combines the items in the two collections as follows:
- First, MergeVersion includes in the resulting collection each item in the Basis Version not changed in or deleted from either the primary version or secondary version. (See "Comparing Versioned Relationships.")
- Second, MergeVersion includes in the resulting collection each item in the primary version's collection that differs from the Basis Version.
- Third, MergeVersion includes in the resulting collection each item in the secondary version's collection that differs Basis Version — provided the corresponding items in the primary version and Basis Version do not differ from each other.
Note The resulting collection can exclude some items found in the basis object version's collection. For example, if the primary version's collection excludes the item, the resulting collection will exclude the item. Similarly, if the primary version's collection includes an item that is identical to an item in the Basis Version's collection, but the secondary object version excludes the item, the resulting collection will exclude the item.
(c) 1988-1998 Microsoft Corporation. All Rights Reserved.