Integrate UML models with other models and tools

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

UML models can be integrated with other models and with domain-specific languages.

You can integrate models in the following ways by writing extension code to perform a variety of functions:

Attach references from any element to other items such as files or to elements in other models. In a UML element, you can store links to other UML elements, files, or other objects by encoding their identities as strings.

For example, you could write an extension that can link any UML action (that is, an element in an activity diagram) to another activity diagram. When the user double-clicks the action, the other diagram opens. This lets the user provide a more detailed view of the action.

There are two ways in which you can store strings and other data in any element:

  • Stereotype properties. You can define a UML profile, in which you define a stereotype that adds properties to specified kinds of UML element. For example, you could define a profile that adds a property named MoreDetail to a UML action. You could write extension code that stores link data in an action by applying the stereotype to the action, and then storing the data in the property.

    The stereotype and its properties are visible to the user in the Properties window.

    To deploy this extension, you would package the profile definition and the extension code in a single Visual Studio Extension.

    For more information, see Define a profile to extend UML.

  • References. You can attach a set of strings to any UML element. You could write code that stores the information such as a filename or the GUID of another element. This can be done without providing additional definitions. References are not directly visible to the user.

There are two ways to encode references to model elements:

  • GUID and Filename of the target model element and the model that contains it, or a particular diagram that displays it.

  • ModelBus References. ModelBus is a framework for creating and resolving references between models. It includes the ModelBus Picker, which lets the user select an element in a model. It also helps the user to resolve references that are lost because of changes in the target model.

    For more information, see Integrating Models by using Visual Studio Modelbus.

    Propagate changes from one model to another. For example, you could synchronize the name of an element with the name of the linked diagram, so that if the user changes one, the other also changes. There are two mechanisms for doing this:

  1. VMSDK Rules can be used to propagate changes inside the same model.

  2. VMSDK Events can be used to propagate changes outside the model – for example, to change the filename of a linked document, or to change an element in another model.

    For information about both these mechanisms, see How to: Respond to Changes in a UML Model.

    Drag elements to copy them from one model to another You can let the user create elements by dragging items onto a UML diagram. The created element does not have to be a copy of the original. For example, you could let the user drag an activity diagram from solution explorer onto another activity diagram, to create a new action.

    For more information see Define a gesture handler on a modeling diagram and How to: Add a Drag-and-Drop Handler.

See Also

Define a menu command on a modeling diagram Define a gesture handler on a modeling diagram How to: Add a Drag-and-Drop Handler How to: Respond to Changes in a UML Model