Define your domain schema with the textual Domain Definition Language

You can define your domain with a textual DSL available with a nuget package.

Add a nuget package reference to your project and select Hyperstore Domain Definition Language

Note that you probably want to edit your model in Visual Studio, and benefit from the colorization and the IntelliSense. For this, please install the HyperStore Domain Language Editor from the Visual Studio gallery.


This package add a new folder to your project containing a domain.definition file containing a sample library domain sample.


A custom msbuild task is added to your project to take into account the code generation process.

You can add many domain definitions in your project by duplicating the model folder.

Domain Definition Language Syntax

Domain declaration

Declare the domain with a full name resulting as a generated schema definition class suffixed by Definition : Hyperstore.Samples.LibrarySample.MyLibraryDefinition

The optional observable attribut adds 'Binding' capabilities to the domain (Property and collection changed events and IDataErrorInfo implementation)

Entity declaration

A check constraint is validated every time a change is made on the entity and can abort the current session if it returns false. The constraint is defined as a lambda expression with a self argument corresponding to the current entity instance.

You can add mulitple constraints by duplicate the check keywords, the last constraints must be terminated by a ';'.

The valid attribute types are : string, int, Guid, Int16, Int32, Int64, UInt16, UInt32, UInt64, bool, char, DateTime, TimeSpan, decimal, double, float.

If your want to use another type, you must declare it at the beginning of the domain definition body using the extern statement. For example, for the CultureInfo type :

In this case, you must provide a SchemaValueObject to define how serialize this type in Hyperstore. See How to define a value object schema definition.

You can define a base class with extends and an interface implentation with implements like that :
def MyEntity extends BaseEntity implements IMyInterface {}

Like custom type, an interface must be declared with the extern keyword :

References declaration

You can define reference with the following syntax (in BNF) :

Name [*] [=>|->] TargetEntityName [*] [ ':' RelationshipName] ';'
  • [] means optional
  • * = cardinality
  • => means embedded relationship (=composition), -> simple reference
  • Name : Name of the property
  • TargetEntityName : A valid entity name
  • RelationshipName : (optional) if not precised, the following pattern is used to define the relationship name : CurrentEntityNameHasTargetEntityName.

Ex., Writing this line in the Library entity :
means : The Members property represents a one to many relationship between Library and Member called LibraryHasMembers

Opposite references declarations

To declare the opposite of an relationship, use the same syntaxe with <- and <=.

Relationship declaration

Like entity, you can declare a relationship to define custom properties. This step is optional, if the relationship has no properties but whatever you declare it or not, a relationship class will be generated.


You must declare terminal entities and cardinality to perform syntax checking.

Note : Don't forget, Hyperstore is a hypergraph, you can declare references in a relationship.

Last edited Apr 20, 2014 at 10:25 AM by Zenasoft, version 14