Domain Model in the Generated API

This topic describes the domain model in the generated API and the type of code that you can create from the .dsl file. In this topic, the Library domain model from

Walkthrough: Creating a Generated API is used to illustrate these concepts. To learn more about the Library domain model, see Library.Dsl Overview.

The names of the elements and relationships in a domain-specific language determine the names of the classes, methods, and properties in the corresponding generated API. The names of elements and relationships in your domain-specific language differ from those in the Library domain model (Library, Books, LibraryHasBooks, and so forth). Therefore, the names of the classes, methods, and properties in your generated API will differ from those that are listed in this topic.

The name of the class for the Library domain model is ExampleModel. The class that is generated from this domain model and its related classes are described as follows.

ExampleModel Class

The domain model contains information about the domain-specific language.

ExampleModel

Initializes a new instance of the ExampleModel class.

public ExampleModel(Store store);

CreateElement

Creates an element of a specified type (any type of element in the domain model). You can also specify property assignments.

public sealed override ModelElement CreateElement(Partition partition, Type elementType, PropertyAssignment[] propertyAssignments);

Creates an element link of a specified type (any type of relationship in the domain model). You can also specify property assignments.

public sealed override ElementLink CreateElementLink(Partition partition, Type elementLinkType, RoleAssignment[] roleAssignments, PropertyAssignment[] propertyAssignments);

GetClosureFilter

Returns an IElementVisitorFilter that corresponds to the ClosureType (or null).

public override IElementVisitorFilter GetClosureFilter(ClosureType type, ICollection<ModelElement> rootElements);

GetGeneratedDomainModelTypes

Returns the list of generated domain model types (classes, relationships, rules).

protected sealed override Type[] GetGeneratedDomainModelTypes();

GetGeneratedDomainProperties

Returns the list of generated domain properties.

protected sealed override DomainModel.DomainMemberInfo[] GetGeneratedDomainProperties();

GetGeneratedDomainRoles

Returns the list of generated domain roles.

protected sealed override DomainModel.DomainRolePlayerInfo[] GetGeneratedDomainRoles();

ResourceManager

Returns the domain model’s resource manager. If the resource manager does not exist, it is created.

private static global::System.Resources.ResourceManager resourceManager;

SingletonResourceManager

Returns the resource manager that can be instantiated only once for this domain model.

public static global::System.Resources.ResourceManager SingletonResourceManager;

DomainModelId

Returns the domain model ID for the ExampleModel class.

ResourceBaseName

Returns the base name of this model's resources.

public const string ResourceBaseName = "ExampleNamespace.GeneratedCode.DomainModelResx";

ExampleModelCopyClosure Class

This class is the copy closure visitor filter for the domain model.

ExampleModelCopyClosureBase Class

This class is an abstract base class for the ExampleModelCopyClosure class.

ExampleModelDeleteClosure Class

This class is the delete closure visitor filter for the domain model.

ExampleModelDeleteClosureBase Class

This class is an abstract base class for the ExampleModelDeleteClosure class.

See Also

Concepts

Functionality of the Generated API

Understanding Generated Properties and Methods

Reference

Store

CreateElement

CreateElementLink

GetClosureFilter

GetGeneratedDomainModelTypes

GetGeneratedDomainProperties

GetGeneratedDomainRoles

DomainModelId

Other Resources

Domain-Specific Language Tools Glossary