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 a sample project in which a profile is deployed together with menu commands and gesture handlers, see Sample: UML Profiles.
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.
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.
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.
Please see the code sample Link UML Elements to Diagrams or other Files. The sample lets users drag a file onto any UML element, and later open the file by double-clicking the element. For example, you could link an activity diagram to a use case element. An icon shows which elements have links.
This code sample demonstrates the following techniques: