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.