Share via


Defining Domain Type Descriptors

By using a ___domain type descriptor, you can add information to a model element in addition to the information that is provided by reflection. You can add type descriptors to ___domain classes, ___domain relationships, shapes, connectors, and diagrams, but the most typical use of type descriptors is to extend ___domain classes. If you have a ___domain relationship between two ___domain classes, you can use a ___domain type descriptor to set a ___domain property in the first class to the value of a ___domain property in the second ___domain class. For example, if you have an embedding relationship between a Book ___domain class and an Author ___domain class, you can use a ___domain type descriptor to set the AuthorName property of the Book ___domain class to the Name property of the Author ___domain class.

Adding a Domain Type Descriptor

To add a ___domain type descriptor

  1. Create a Domain-Specific Language Tools solution by using the Minimal Language template.

  2. Add two ___domain classes, one named Book and the other named Author.

  3. Add an embedding ___domain relationship between ExampleModel and Book.

  4. Add an embedding ___domain relationship named BookHasAuthor between Book and Author.

  5. Set the multiplicity of the source role (the role between Book and BookHasAuthor) to 1..1.

  6. In the DSL Explorer, right-click the Book ___domain class, and then click Add New DomainTypeDescriptor.

    A node named Paths of Custom Property Descriptors appears under the Custom Type Descriptor node.

  7. Right-click the Custom Type Descriptor node, and then click Add New PropertyPath.

    A new property path appears under the Paths Of Custom Property Descriptors node.

  8. Select the new property path, and in the Properties window, set Path to Property to the path of the appropriate model element. The path should resemble BookHasAuthor.Author/!Author.

    You can view the model tree by clicking the down arrow to the right of this property. For more information about ___domain paths, see Domain Path Syntax.

  9. Set Property to the Name ___domain property of Author.

Change History

Date

History

Reason

July 2008

Rewrote and refactored project.

Content bug fix.