Sharing Run-time Objects with a Shared Repository Instance

There are other effects (besides shared transaction space) of sharing a repository instance with the Repository Add-in. Most notably, if you share a repository instance, you can directly manipulate the same Automation objects that the Repository Add-in is using. This can improve the efficiency of your add-in.

Consider what happens when the Repository Add-in fires an event indicating that an MdoVBForm object has been added to the repository. The event parameters include an interface pointer to the Automation object representing the MdoVBForm. If you are using the same repository instance as the Repository Add-in, you can use this Automation object to immediately begin manipulating the repository object representing the MdoVBForm. If you are not using the same repository instance, you must perform additional steps to initialize your own Automation object:

  1. Using the same repository instance that the Repository Add-in is using, retrieve the internal identifier from the Automation object that represents the new MdoVBForm.

  2. Using your private repository instance, use the GetObject method to instantiate an Automation object whose internal identifier matches the one you just retrieved.

  3. Manipulate the MdoVBForm via your new Automation object.