Partager via


Customizing Your Model with Profiles and Stereotypes

In Visual Studio Ultimate, you can adapt the standard UML model elements, such as classes and components, to customize them for specific purposes. You can apply a stereotype to a model element that can change the element's list of properties. Stereotypes are defined within collections called profiles.

To use a stereotype, you link a package to a profile. This lets you apply the stereotypes that are defined in the profile to the elements in the package.

Some profiles are installed together with Visual Studio Ultimate. In addition, you can define your own profiles.

Stereotypes can be set in the Properties list of an element. For the major kinds of shape on a diagram, the applied stereotypes also appear in the shape, as shown in the example.

A UML class with a stereotype.

Note

If you use a profile to create a model, and then share the model with someone else, they will be unable to see the stereotypes unless they have installed the same profile on their computer.

Title

Description

How to: Add Stereotypes to Model Elements

Placing a model element in a package, linking the package to a profile, and applying a stereotype to the element.

Standard Stereotypes for UML Models

The UML Standard Profiles L2 and L3 are installed together with Visual Studio Ultimate, and every model is linked to them by default. They provide stereotypes that you can use to annotate your models. 

For example, you could apply the «specification» stereotype to a class to indicate that it is intended only to define the externally-visible behavior of its instances,

How to: Define a Profile to Extend UML

You can define your own stereotypes and tools that are adapted to your own application area.

For example, if you develop banking software, you could define an «Account» stereotype that can be applied to classes. You could then use class diagrams to describe different types of account and their relationships.

How to: Install a UML Profile

If someone has given you a UML Profile, you can install it on your computer.

How to: Define a Custom Modeling Toolbox Item

A custom toolbox item saves you from repeatedly setting a stereotype on new elements.

Color UML Classes by Stereotype

This sample code extends the UML diagrams. It automatically sets the color of a UML shape according to the stereotype of the element.