[V8i/CE C++] How to publish DGN with references to i-model


my question is about the best workflow in V8i, but I think the same can be asked for CE implementation, so I included both versions in the subject.

I have DGN file with references (often) and more models in the main DGN file (sometimes). Some elements in models contain data in custom format, partially depending on extrernal data sources. I need to publish DGN file to i-model package including the custom data. During the conversion, the original files have to remain unchanged.

What is a recommended workflow and best practice? I do not ask how to convert custom data to "i-model supported format", this part is implemented already, I am able to create EC schema(s) based on custom data structures and to attach EC data to elements, and it works fine. My question is about how to manipulate with elements, models and references.

One alternative I have thoguht about is to make a copy of the whole structure, do necessary data conversion, and to use i-model API (imodelPublisher class etc.) to publish model(s) with references.

I read i-model Primer in MicroStation Programmer Guide, but I think I do not understand well enough the description when work DGN file should be used and how references are supported in the described workflow. When I simplify the workflow described in the guide, it's:

  1. Open DGN file and model to be published.
  2. Use mdlUndo_mark function to avoid changing original data.
  3. Use ElementGraphicsProcessor or any toher type of scanning to scan the model content.
  4. When necessary, convert custom data to EC data, create EC schema also (I have working code, fully in C# now).
  5. Set i-model publishing parameters and to publish the file.

What I miss in the description is when to rewert changes (I guess when i-model publishing is finished) and also (more important) when and how to modify more models in opened DGN file and attached references.

With regards,