This project is read-only.

How to change the Identity Generator

All elements in Hyperstore are identified by a technical identity. This identity is generated by the domain identity generator when a new instance is created.

An identity is composed of two parts :
  • The instance domain name
  • A key (which must be unique in the domain) as a string.
The two parts of the identity are separated by a ':'.

Note : You can access the identity property through the IModelElement interface. You must implicity cast your object to this interface in order to access its properties.

    var library = new Library();
    var id = ((IModelElement)library).Id;

The default identity generator uses Guid to generate the key but you can change this using the domain configuration argument of the CreateDomainModelAsync method.

  var config = new DomainConfiguration()
                   resolver => new Hyperstore.Modeling.Domain.LongIdGenerator()
  var domain = await store.CreateDomainModelAsync("Test", config);

Custom id generator

You can create your own identity generator by implementing IIdGenerator.

Last edited Apr 17, 2014 at 10:48 AM by aguerot, version 7