Share via


Defining Domain Models

The first step in defining a ___domain-specific language is to add ___domain classes and ___domain relationships to the ___domain model.

Adding Domain Classes to the Domain Model

Domain Classes and Named Domain Classes

You can add a ___domain class or named ___domain class by dragging the one that you want from the Toolbox to the diagram. For more information, see Defining Domain Classes.

Domain Properties

You can add a ___domain property to a ___domain class by right-clicking the Domain Properties compartment of the ___domain class on the diagram and then clicking Add New Domain Property. You can change the name and the type of the ___domain property in the Properties window. You can add your own external types or enumerations to the model. For more information, see Defining Domain Properties.

Domain Enumerations and Enumeration Literals

You can add a ___domain enumeration by right-clicking the root of the model in the DSL Explorer and then clicking Add New Domain Enumeration. The element will appear in the DSL Explorer under the Domain Types node. This element does not appear on the diagram. To add enumeration literals to the ___domain enumeration, right-click the ___domain enumeration in the DSL Explorer and then click Add New Enumeration Literal.

External Types

An external type is not defined by the ___domain-specific language; instead, it is defined by another source, for example, System.Drawing.Color. In the DSL Explorer, right-click the root of the model, and then click Add New External Type. After you add the external type, give it the correct type name in the Properties window. For more information, see Defining Domain Enumerations and External Types.

Adding Domain Relationships to the Domain Model

Embedding Relationships

To add an embedding relationship, in the Toolbox, select the Embedding Relationship tool and, in the diagram, click the first ___domain class and then click the second ___domain class. If the relationship is valid, it will appear on the diagram as a line that contains a box for the name of the embedding relationship. The source ___domain class of an embedding relationship is the ___domain class that is the parent of the target ___domain class. By default, the name of the ___domain relationship is composed of the Name property of the source ___domain class (the containing class) and the Property Name property of the source ___domain class, as follows: SourceClassNameHasSourcePropertyName. If you change the name of a role on one end of the relationship, the relationship name will change to SourceRoleHasTargetRole. You can change these names.

Reference Relationships

You can add a reference relationship between two ___domain classes by selecting the Reference Relationship tool in the Toolbox, and then clicking the first ___domain class and then the second ___domain class. If the relationship is valid, it will appear on the diagram as a dotted line that contains a box for the name of the reference relationship. By default, the name is SourceClassReferencesSourcePropertyName.. If you change the name of a role on one end of the relationship, the relationship name will change to SourceRoleReferencesTargetRole. You can change these names.

Inheritance Relationships

You can add an inheritance relationship by selecting the Inheritance tool in the Toolbox, and then dragging the derived class to the base class. If the relationship is valid, it will appear on the diagram as a straight line that has a hollow arrow that points from the derived class to the base class. Inheritance relationships do not have names or other properties.

For more information, see Defining Domain Relationships.

Customizing Model Elements

Element Merge Directives

By using element merge directives, you can specify what occurs when an element is added to the model. You can specify that new relationships are to be added between a new element and existing elements, or specify that a new element be made a child of an existing element. For more information, see How to: Add Element Merge Directives.

Domain Type Descriptors

You can use ___domain type descriptors to add information to the elements of your ___domain-specific language, in particular by creating a reference between a ___domain class and a property of a second ___domain class. For more information, see Defining Domain Type Descriptors.

Deletion Behavior

You can customize how model elements and relationships are deleted. For more information, see How to: Modify Deletion Behavior.

Custom Attributes

You can add attributes to modify your model elements. For more information, see How to: Add Custom Attributes.

Changing the Namespace

You can change the namespace of your ___domain-specific language. For more information, see How to: Change the Namespace of a Domain-Specific Language.

Domain-Specific Language Tools Glossary

Change History

Date

History

Reason

July 2008

Rewrote and refactored project.

Content bug fix.