How to define a ValueObject

A ValueObject represents an immutable value (which it's not the case for an entity).

Every type in Hyperstore must have a schema defining it. A schema provides to Hyperstore informations about how to serialize the type and defines its default value.

Hyperstore needs to know how to serialize a value to persist it or to use it in an event.

There are some predefined schemas (called primitive schemas) for all the C# value types. But you can create your own schema for specific type.

A good example is the CultureInfo type which can not be serialized in .Net. So we must create a schema to define it by creating a class which inherits from SchemaValueObject<>.


To register this schema, just create a new instance in the DefineSchema method of the SchemaDefinition.

or add a declaration in the textual DSL like this : extern fullClassName as alias ;

Last edited Apr 30, 2014 at 12:10 PM by Zenasoft, version 8