This documentation is archived and is not being maintained.

Working with Domain Models Programmatically 

This section shows you how to use custom code to access and modify a domain model, which is a graphical in-memory store representation of a domain-specific language. You create a domain model when you complete the Domain-Specific Language Designer Wizard.

When you create a domain model, the wizard generates code for your model. This code represents the elements in your model and their relationships. You can modify this code or create code on your own.

You should not modify generated classes directly because they are regenerated each time that you build a project. To make sure that your custom code does not get erased, you should override the class that you want to modify and make sure that the Generates Double Derived property is enabled. If this property is enabled, you can generate a partial class from a generated class and prevent your custom code from being erased.

In This Section

Writing Changes to the Store

Explains how to create and delete elements and links programmatically.

Getting Information from the Store

Describes how to find information in the store.

Responding to Changes in the Model

Describes the different ways that you can provide custom code to run when specific actions occur.

Working with Metadata in the Store

Describes how to use the metadata about types in the store.

Undoing and Redoing a Set of Changes

Explains how to undo or redo a set of changes programmatically.

Common Tasks with Domain Models

Gives additional information about how to work with models programmatically.

How to: Set Diagram Background Image

Explains how to add custom code that adds a background image to the generated designer.

Related Sections

Adding Validation to Domain-Specific Language Solutions

Describes how to add validation to your domain models.

Overview of Models

Explains models and how they are used in a domain-specific language solution.

Understanding the Generated API

Explains what the generated API is and how it is used.

Domain-Specific Language Tools Glossary

Defines the terminology that is used for Domain-Specific Language Tools.