Share via


Properties of Domain Properties

A ___domain property is a feature of a model element that can hold a value. For example, the Person ___domain class could have properties Name and BirthDate. In the DSL Definition, ___domain properties are listed in the ___domain class box on the diagram and under the ___domain class in DSL Explorer. For more information, see How to Define a Domain-Specific Language.

Note

The word "property" has two uses. A ___domain property is a feature that you define on a ___domain class. By contrast, many elements of a DSL have properties, which are listed in the Properties window in the DSL Definition. For example, every ___domain property has a set of properties, which are described in this topic.

At run time, when a user creates instances of the ___domain class, the values of the ___domain properties can be seen in the Properties window, and can be displayed on the shapes.

Most ___domain properties are implemented as ordinary CLR properties. However, from a programming point of view, ___domain properties have richer functionality than ordinary program properties:

When you select a Domain Property in a diagram or in DSL Explorer, you can see the following items in the Properties window. For more information about how to use these items, see Customizing and Extending a Domain-Specific Language.

Property

Description

Default Value

Description

The description that is used to document the user interface (UI) of the generated designer.

<none>

Display Name

The name that will be displayed in the generated designer for this ___domain property. It can contain spaces and punctuation, for example "Song Title".

<none>

Element Name Provider

This is applicable only if you have set Is Element Name to true. You can write code that provides a name for a new element of a ___domain class, overriding the default behavior.

In a code file in the DSL project, create a class that is derived from ElementNameProvider.

Then in DSL Explorer, right-click the root of the DSL, and click Add External Type. Enter the name of your class.

Select this ___domain property again, and select the name of the class in the drop-down list.

<none>

Getter Access Modifier

The level of access of the ___domain class (public or internal). This controls the scope in which program code can access the property.

public

Help Keyword

The optional keyword that is used to index F1 help for this ___domain property.

<none>

Is Browsable

If True, the ___domain property is displayed to the user in the properties window when models of this DSL are open.

If False, the ___domain property is hidden in the UI.

If you want to make the ___domain property visible but read-only, set Is UI Read Only.

True

Is Element Name

If True, this ___domain property will be displayed as the name of its model element in DSL Explorer.

New model elements will receive a unique default value for this property. If you want to control how these values are generated, set Element Name Provider.

False

Is UI Read Only

If True, the value of the ___domain property cannot be changed by using the UI. It can still be set by programs, and will be visible in the Properties window.

If you want to hide the ___domain property from the user, set Is Browsable. If you want to control access by programs, set Setter Access Modifier.

False

Kind

The kind of ___domain property (Normal, Calculated, or CustomStorage). For more information, see Calculated and Custom Storage Properties.

Normal

Name

The name of this ___domain property. It must be a valid identifier, for example SongTitle.

<none>

Notes

Informal notes that are associated with this ___domain property.

<none>

Setter Access Modifier

The access modifier for the setter. This controls the scope in which program code can set the property.

public

Type

The type of property. To add to the list of available types, right-click the root of the DSL in DSL explorer, and click Add External Type.

String

See Also

Other Resources

Domain-Specific Language Tools Glossary