Share via


How to: Add a Port (DSL Explorer)

You can use port shapes to produce ports on domain classes in the diagram for a generated designer. For more information, see Port Shape (Domain-Specific Language Designer).

The Components Diagram sample demonstrates the use of port shapes. For more information, see Components Diagram Sample.

To add a port shape to the definition of a domain-specific language by using DSL Explorer, use the steps in the following procedure.

To add a port shape using DSL Explorer

  1. In DSL Explorer, right-click the Dsl node, and click Add New Port.

    A port shape that is named Port1 appears in the Diagram Elements swimlane.

  2. Optionally, add decorators, such as text and an icon, to the port shape. For more information, see How to: Add a Decorator.

  3. Optionally, add domain properties to the port shape. For more information, see How to: Add a Domain Property.

  4. In the Properties window, set any properties. For example, you can change the default value of the Geometry property from rectangle to circle and the Outline Color property from black to green.

    After you add and customize the port shape, you must then map it to a domain class or a named domain class by using the Diagram Element Map tool or the Diagram node in DSL Explorer. For more information, see How to: Add a Domain Class to a Domain-Specific Language Definition, How to: Map Elements By Using the Diagram Element Map Tool, or How to: Add a Shape Map (DSL Explorer).

    Next, you create an ElementTool item for the Toolbox by using DSL Explorer. For more information, see How to: Add an Element Tool.

    You can now click Transform All Templates in Solution Explorer and start a Visual Studio experimental build to verify that the port shape has been defined and mapped to a domain class.

See Also

Concepts

Domain-Specific Language Designer Terminology Overview

Defining Diagram Elements

Domain-Specific Language Tools Glossary

How to: Add a Port Shape to a Domain-Specific Language Definition

Domain-Specific Language Tools Glossary