Share via


Accessing the Store Programmatically

All additions, deletions, and modifications that are made to a model occur in an in-memory data structure called the store. The store contains information about one or more models. The store can contain a collection of models, although often only one model is in the store. The store also contains metadata about a model (data about the types that are allowed in the model and their relationships and properties).

The DomainDataDirectory property of the Store class contains information about the domain classes, domain relationships, domain roles, and domain properties in the domain model.

The store also contains information about the elements and links in the model. For more information, see the ElementDirectory property of the Store class.

From the store, you can navigate to the individual items in the store. You can get information about elements or types. You can also:

  • add elements and links

  • delete elements and links

  • modify existing elements and links and their properties

Transactions

When you modify the store, you must enclose any code that writes to the store in a Transaction. To commit the changes that you make in a transaction, you must call Commit on that transaction. You can cancel all the changes to the store that you made in a transaction by doing a Rollback of the transaction (or by not doing a Commit of the transaction). The transaction will not be committed, for example, if an exception is thrown and not caught in the transaction.

Rules and Events

The store has a RuleManager property that you can use to subscribe to rules. The store also has an EventManagerDirectory property that you can use to subscribe to events with an event handler in your custom code.

Undo and Redo

The store has an UndoManager property, which has members that you can use to undo and redo changes to the store.

You can use UndoManager to undo actions that occur to the store during a transaction. UndoManager also provides functionality to redo a set of changes to the store after an undo action.

See Also

Concepts

Using the Store Viewer

Other Resources

Domain-Specific Language Tools Glossary

Change History

Date

History

Reason

July 2008

Rewrote and refactored project.

Content bug fix.